![]() |
triggeractions and serverside question
1 Attachment(s)
Ive been having trouble with triggeraction and serverside. I know nothing about them. I know I need them in most online npcs though.
I was trieing to make it so on clients side when you say /kick (acc), it warps the acc to OSL, it works but only when you have the weapon equiped. I attached the script for referance or w/e. |
Im only half awake XD so it may not work
1 Attachment(s)
I did it in both Gscripts
Gs1 is on the top,Gs2 is below it |
Thanks :D, aside from a few syntax errors (easy to solve), they worked good!
So, how do these actions work? Whats this #p(0)-4? |
Hmm, that would not give an accurate representation of where the person has been kicked from. It would only say what level the person who kicked the player was in.
PHP Code:
|
Ok thanks but how does the script work? I need to understand triggeractions and serverside stuff.
|
Quote:
Edit: I also did note, I dont script in GS1 anymore, So scripting in it for one script here and there is aquard, Sorry for any syntax errors :P Edit2: Your right, It doesnt send to nc where the player was kicked from, Only where the kicker was at XD |
Quote:
The message is Admin has kicked player from level |
Uhm, isn't case a lot better then doing if (params[1] == "blah") { } ?
And why not use substring? And is their any reason why .graal was used, and not .nw? Here, I did some edits, you don't need to use "" anymore as their is no need for tokens. If theirs a bug with it, just tell me ;O. I tested, it worked fine: PHP Code:
*Edit* Alright, I added the check..and yeah, I do not know how to use GS2 return :-(. If anyone wants to post the correction way, you may do so, but I think that works fine. Also, I took player.level off the params, and made it so you can get the level via findplayer (plyr.level). I also didn't test this version. |
add a level check, if the player isn't online you'll get an ugly message in RC.
|
Yea, I must of been really tired... I do use case lol...
|
this may be off topic but if u make the weapon -Staff/kick it would work still much easyer as i found out in my time scripting but wich i have stoped till i understand gs2 better
|
#p() or pramas[] refers to the paramater sent from the the triggeraction to the action.. in this case sending paramaters from clientside to serverside so
gs1 (which you shouldn't be using anymore) triggeraction 0,0,serverside,Weapon,#a,test1,test2; #a = the first paramater or #p(0) test1 = the second paramater or #p(1) so on and so forth gs2 triggeraction(0,0,"serverside","Weapon",player.acc ount,"test1","test2"); player.account = the first paramter or params[0] so on and so forth i am sure you get the idea by now and if your not triggering an action to a weapon the it just starts the first paramater after the action its calling IE: triggeraction(x,y,"serverside",player.account); hope that cleared it up a bit better for you |
Quote:
Quote:
>> triggeraction 0,0,serverside,WEAPONNAME,kick,#T(#e(5,-1,#c)); |
[QUOTE=ApothiX]The person did not specify if they were using the old or new engine, so you must assume that they are using the old. There is no such thing as a case statement in the old engine. Also, using a switch-case statement when there will be only one check is unnecessary.[/QUOTE
I do not assume that they are using the old one, because I haven't seen any private server thats been up for a week or two with GS2 NOT ENABLED. Quote:
heres some help for yourself: triggerserver("gui","WEAPONNAME","Params","Go","He re"); :-). Use it..it was made for a reason. |
Quote:
Here's a GS1 example: NPC Code:if (created) setshape 1, 32, 32; Look in the triggeraction. #c is param 0, or #p(0). One thing you should know is that most things start with a value of 0. These include tokenizing, arrays, etc... Anyway, param 0 is #c, or the player's chat. It's transfering what the player sayed in the action. So, when the action is recieved on the serverside, it's telling you param 0, or #p(0). Triggeractions also need a surface to trigger. This can either be a non-transparent surface of an image or a setshape. Here's an example of how this would work in GS2. NPC Code:function onCreated() Not too much different. |
| All times are GMT +2. The time now is 05:23 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.