Help with a new function - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with a new function (
/showthread.php?tid=224806)
Help with a new function -
Zack9764 - 12.02.2011
I'm using a 'new' function so where when someone types a CMD it sets the new function to 1. How do I define the user who is using it's playerid with this function?
Re: Help with a new function -
Calgon - 12.02.2011
Could you be a bit more specific? Are you trying to change a variable when a player uses a specific command? If so, what's the name of the variable?
Re: Help with a new function -
Zack9764 - 12.02.2011
Ok so when a person types a CMD, by default the function is set to 0. Then when he types this CMD it's set to 1. How can I define that person's playerid? I'm thinking something like
new function =1[definedid] ?
I don't like to give out a lot of my script ideas. :S
Re: Help with a new function -
Calgon - 12.02.2011
At the top of your script:
pawn Код:
new functionUsage[MAX_PLAYERS];
To set the value (in the command or whatever):
pawn Код:
functionUsage[playerid] = 1;
Re: Help with a new function -
Zack9764 - 12.02.2011
Says playerid is not defined.
Re: Help with a new function -
Zack9764 - 12.02.2011
I narrowed it down to only one error. Here's the error lines:
Код:
new TVMan
TVMan = OnTV[playerid]; // Error line
Error:
Код:
error 001: expected token: ";", but found "-identifier-"
Re: Help with a new function -
Mean - 12.02.2011
You forgot a ";"
Re: Help with a new function -
Niixie - 12.02.2011
You can shorten it one line by typing it like this
pawn Код:
new TVMan = OnTV[playerid];
And it also looks cleaner
Re: Help with a new function -
Zack9764 - 12.02.2011
aaah!