Mute player if he uses this more than X times
#1

So players can spam the chat with the engine on/off key bind.

how can i mute a player if he spam pressing 2?

this is the code.

PHP код:
    if ((newkeys==KEY_SUBMISSION))
    {
        if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridCOLOR_WHITE"{FFFFCC}Error: You are not driving any car.");
        new 
string2[128];
        new 
vehid GetPlayerVehicleID(playerid);
        if(
IsABike(vehid)) return SendClientMessage(playeridCOLOR_WHITE"{FFFFCC}Error: You can't turn on engine on a bike!");
        if(
Gas[vehid] == 0) return SendClientMessage(playeridCOLOR_WHITE"{FFFFCC}Error: This vehicle doesn't have fuel.");
        new 
e,l,a,d,b,bo,o;
        
GetVehicleParamsEx(vehid,e,l,a,d,b,bo,o);
        new 
name[25];
        
GetPlayerName(playeridnamesizeof(name));
        if(
== 0)
        {
        
SetVehicleParamsEx(vehid,1,l,a,d,b,bo,o);
        
format(string2sizeof(string2), "* %s turns on the engine of %s."name,vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
        
ProxDetector(30.0playeridstring2COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        else
        {
        
SetVehicleParamsEx(vehid,0,l,a,d,b,bo,o);
        
format(string2sizeof(string2), "* %s turns off the engine of%s."name,vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
        
ProxDetector(30.0playeridstring2COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    } 
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)