17.06.2011, 06:47
Hello guys, i want to make a few commands that will work only for the players that i will choose, when someone else type this command will take a message "You can't use this command" , how can i do this?
canUse[MAX_PLAYERS];
CMD:sayhello(playerid, params[])
{
if(canUse[playerid] == 0) return SendClientMessage(playerid, 0xFFFF00AA, "You can't use this command!"); //Checks if the array we made was equal to 0, if so sends that client message
SendClientMessage(playerid, 0xFFFF00AA, "Hello!"); //This will be sent if the array canUse[playerid] is not 0, so it can be 1, 2, etc.
return 1;
}
CMD:allowcmd(playerid, params[])
{
if(canUse[playerid] == 1) return SendClientMessage(playerid, 0xFFFF00AA, "You can already use the private commands!"); //Checks if they can already use the commands or not
canUse[playerid] = 1; //Sets the array to 1, allowing the sayhello command to work
return 1;
}
canUse[playerid] = 0;
Use booleans for this purpose I don't see whats the point to use an integer to check for somethings thats either on/off.
|
I don't see a reason to f*ck around with warnings so just leave it with integers.
No more posts from newbies. They will learn everithing. |