new Variable[MAX_PLAYERS];
if (strcmp("/cmd", cmdtext, true, 10) == 0) { if(Variable[playerid] == 3) { SendClientMessage(playerid, -1, "You can use this command just 3 times"); } //do something Variable[playerid] += 1; }
Make a variable and add it to a command ex:
Код:
new Variable[MAX_PLAYERS]; Код:
if (strcmp("/cmd", cmdtext, true, 10) == 0) { if(Variable[playerid] == 3) { SendClientMessage(playerid, -1, "You can use this command just 3 times"); } //do something Variable[playerid] += 1; } |
CMD:bomb(playerid, params[]) { if(C4Enabled == 0) return 1; if (PlayerInfo[playerid][pMember] == 0 || PlayerInfo[playerid][pLeader] == { if (PlayerInfo[playerid][pC4] == 0) { if (PlayerInfo[playerid][pBombs] != 0) { if(IsPlayerInAnyVehicle(playerid)) { SendClientMessageEx(playerid, COLOR_LIGHTRED,"You can't plant C4 while in a vehicle!"); return 1; } GetPlayerPos(playerid,Positions[0][0], Positions[0][1], Positions[0][2]); SetPVarFloat(playerid, "DYN_C4_FLOAT_X", Positions[0][0]); SetPVarFloat(playerid, "DYN_C4_FLOAT_Y", Positions[0][1]); SetPVarFloat(playerid, "DYN_C4_FLOAT_Z", Positions[0][2]); PlayerInfo[playerid][pC4] = CreateDynamicObject(1654, Positions[0][0], Positions[0][1], Positions[0][2]-0.9, 0, 89.325012207031, 3.9700012207031); ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0 ,0,0,0,0); ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0 ,0,0,0,0); SendClientMessageEx(playerid, COLOR_GREEN, "You have placed C4 on the ground, /pickupbomb to remove it."); //PlayerInfo[playerid][pC4] = 3; PlayerInfo[playerid][pBombs]--; PlayerInfo[playerid][pC4Used] = 3; } else { SendClientMessageEx(playerid, COLOR_GRAD2, "You do not have C4!"); return 1; } } else { SendClientMessageEx(playerid, COLOR_GRAD2, " You can only deploy 1 C4 at a time ! "); return 1; } } else { SendClientMessageEx(playerid, COLOR_GRAD2, " text here ! "); } return 1; } |