![]() |
Freezing a player serverside.
Is there any possible way to freeze a player serverside? I have tried pl.freezeplayer(time); and pl.disabledefmovement(); neither of them seem to work. Is there any other way to do it? If so can you explain to me the process of doing so.
|
Both of those commands are clientside. And no, there is no way to freeze the player directly from serverside. I've always found it beneficial to create a system weapon to handle things like this:
PHP Code:
PHP Code:
|
I thought I couldn't trigger clientside after I triggered serverside?
EDIT: Could you also show me an example of how it would look in a class so i would be able to do player.freeze('time'); It doesn't need to be the freeze example it could be any easy example like player.apset('blahblah'); even though there is already a command for that it's the only thing i could think up off the top of my head haha. |
Quote:
PHP Code:
You can also trigger weapons of other players. PHP Code:
That would trigger serverside, try to find a player with the community name 'cbk1994', and if found, trigger clientside on the same weapon for that player. Once it receives the trigger clientside, it would set my chat to 'Engine: Hi there ugly!'. This is a bit of a silly example since you can set players' chat serverside, but it could be used, for example, if you have some kind of GUI window displaying the message. |
Quote:
|
Oh, how long have we been able to trigger so easily back and forth?
|
Quote:
|
Yeah, I got to work with the npc server some before my "long vacation" if you will. Maybe it's because I was younger, but it seemed way complicated to do it with gs1 and make it look easy.
NPC Code: I have been looking at this line, am I to understand "gui" refers to Weapons/Gui npc's and 'this.name' is the name of the current weapon/gui npc and that's why it triggers the 'onActionServerside' from the current weapon? I suppose it may be obvious, but hey i'm here to get this stuff down, and I want to know exactly why i am typing something if I have to include it. |
Quote:
triggerServer(type, script, param1, [...]); 'type' can be 'gui' or 'weapon' (Weapon/GUI scripts; personal preference which to use) or 'npc' (DB npc). 'script' is the name of the script. You can always use 'this.name' if triggering the same script. This is preferable since it makes it easy to change script names without a lot of refactoring. With GS1 it was something like PHP Code:
|
Quote:
PHP Code:
|
Quote:
|
Quote:
I have been trying to sharpen my scripting skills lately and I ran into a problem with this.. The script works fine and everything but I don't understand why we have to put the quotation marks around the "message" or else it wont register. I believe there is another way to read the player chat but I'm unsure of it. |
Quote:
PHP Code:
The alternative is to use string.substring(startIndex, length) which simply takes part of a string: PHP Code:
PHP Code:
However, this doesn't work as well for commands with multiple parameters. For the command "/tell [account] [message]", the number of characters to chop off the front of the player's chat to get the message depends on how long the account is, which varies. We can use tokenize to split at spaces, take the length of the second token (the account), and use that to determine the number of characters to chop off to get the message: PHP Code:
In other words, using the script above, I couldn't say "/tell Fidel Castro hi there!". Even though "Fidel Castro" is an actual account, there is no way for the command to know that because it has a space (some accounts contain spaces). It will try to send the message "Castro hi there!" to account "Fidel". Using tokenize we can just use: Quote:
|
Ahh! Wow. I totally had the wrong idea on tokens, but now I fully understand them. Thanks, rep+ .
|
Quote:
I.e. PHP Code:
PHP Code:
|
| All times are GMT +2. The time now is 04:53 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.