Question? - 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)
+--- Thread: Question? (
/showthread.php?tid=618047)
Question? -
Tass007 - 30.09.2016
Hey guys. I'm making a system and I wanted to know if it's possible to check and see if a player performed commands before typing another command for example.
Player needs to either use /me or /do 10 times and contain more than 10 characters before the player can type /robstore. Is this possible and if so what would the recommended process be?
Re: Question? -
Jack_Leslie - 30.09.2016
It would be very possible.
Have a variable for the player, and then each time the player does /me or /do add a value to the variable. Then, on the /robstore command, make a check to see if the variable is more than 10.
Example:
pawn Код:
CMD:me(playerid, params[])
{
// command
playerInfo[playerid][pCount] ++;
return 1;
}
CMD:robstore(playerid, params[])
{
if(playerInfo[playerid][pCount] < 10) return SendClientMessage(playerid, COL_RED, "You can not perform this command!");
// command
return 1;
}
Re: Question? -
Tass007 - 30.09.2016
Awesome thank you. Never thought about it like that.
Re: Question? -
Tass007 - 02.10.2016
Is there a way to see if the EXACT last command preformed were /me or /do?
Re: Question? -
Rdx - 02.10.2016
You can save last command to array.
Re: Question? -
Tass007 - 02.10.2016
How would I do that??
Re: Question? -
Rdx - 02.10.2016
OnPlayerCommandPerformed:
Quote:
format(playerInfo[playerid][player_last_command], sizeof(cmd_text), "%s", cmd_text);
|
Check:
Quote:
if( strfind(playerInfo[playerid][player_last_command], "/me", true) != -1)
{
//last comand was /me, you can apply your code
}
|