Question?
#1

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?
Reply
#2

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;
}
Reply
#3

Awesome thank you. Never thought about it like that.
Reply
#4

Is there a way to see if the EXACT last command preformed were /me or /do?
Reply
#5

You can save last command to array.
Reply
#6

How would I do that??
Reply
#7

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
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)