You don't need a timer there.
PHP код:
new commandTime;
CMD:fr( playerid, params[] )
{
if (gettime() - commandTime < 120) return SendClientMessage(playerid, -1, "Wait 2 minutes before you use this command again.")
new rand = random( 10 );
new id,Float:x,Float:y,Float:z;
commandTime = gettime();
switch( rand )
{
case 1: // if rand is between 0 and 2 then run the code here
{
GivePlayerWeapon(playerid, 31, 9999);
SendClientMessage(playerid,-1,""chat""COL_RED" You got ultimate M4 weapon ammo!");
}
case 2: // if rand is between 3 and 5 then run the code here
{
SetPlayerSkin(playerid, 123);
SendClientMessage(playerid,-1,""chat""COL_RED" You're Thug now!");
}
case 3: // if rand is between 6 and 8 then run the code here
{
SetPlayerHealth(playerid, 10);
SendClientMessage(playerid,-1,""chat""COL_RED" UPS!");
}
case 4: // if rand is between 9 and 11 then run the code here
{
GetPlayerPos(id,x,y,z);
SetPlayerPos(id,x,y,z+10);
SendClientMessage(playerid,-1,""chat""COL_RED" UPS!");
}
case 5: // if rand is between 9 and 11 then run the code here
{
SetPlayerScore(playerid, GetPlayerScore(playerid) + 100);
SendClientMessage(playerid,-1,""chat""COL_RED" You got some EXP!");
}
case 6: // if rand is between 9 and 11 then run the code here
{
SetPlayerColor(playerid,0xCC0000);
SendClientMessage(playerid,-1,""chat""COL_RED" You're unique now!");
}
case 7:
{
SendClientMessage(playerid,-1,""chat""COL_RED" Nothing happened!");
}
case 8:
{
SendClientMessage(playerid,-1,""chat""COL_RED" Nothing happened!");
}
case 9: // if rand is between 6 and 8 then run the code here
{
SetPlayerArmour(playerid, 95);
SendClientMessage(playerid,-1,""chat""COL_RED" You got Armor");
}
}
return 1;
}