Problem with disabling commands
#10

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
You need to read all of the comments, everything is explained.
Reply


Messages In This Thread
Problem with disabling commands - by martoivanov - 19.06.2013, 16:31
Re: Problem with disabling commands - by Juanxz - 19.06.2013, 17:01
Re: Problem with disabling commands - by Can4ns - 19.06.2013, 17:09
Re: Problem with disabling commands - by Can4ns - 19.06.2013, 17:23
Re: Problem with disabling commands - by martoivanov - 19.06.2013, 17:25
Re: Problem with disabling commands - by Scenario - 19.06.2013, 17:47
Re: Problem with disabling commands - by martoivanov - 19.06.2013, 17:49
Re: Problem with disabling commands - by Scenario - 19.06.2013, 17:51
Re: Problem with disabling commands - by martoivanov - 19.06.2013, 17:56
Re: Problem with disabling commands - by Scenario - 19.06.2013, 18:04

Forum Jump:


Users browsing this thread: 1 Guest(s)