19.06.2013, 18:04
pawn Код:
CMD:dmzone(playerid, params[])
{
if(GetPVarType(playerid, "DMZONE") != 0) // are they already in a dm zone?
return SendClientMessage(playerid, COLOR, "You're already in a DM zone silly child!");
// if they weren't in a DM zone, the code below this will be executed
SetPVarInt(playerid, "DMZONE", 1); // set the pvar to show that they're in a DM zone
SendClientMessage(playerid, COLOR, "Welcome to the DM zone!");
return 1;
}
CMD:testcommand(playerid, params[])
{
if(GetPVarType(playerid, "DMZONE") != 0) // are they in a dm zone?
return SendClientMessage(playerid, COLOR, "You cannot use this command while in a DM zone."); // yes, send them a message; they cannot use this command
// if they aren't in a DM zone, execute some code
SendClientMessage(playerid, COLOR, "Test message");
return 1;
}
// When you remove a player from a DM zone, make sure you add "DeletePVar(playerid, "DMZONE");" to your code as it will make it so they aren't registered in a DM zone and delete the pvar, obviously by the title
// You can use "GetPVarType(playerid, "DMZONE")" in filterscripts as data from a PVar is in a server's memory