How put timer in command
#4

Quote:
Originally Posted by Skimmer
Посмотреть сообщение
You don't need a timer there.

PHP код:
new commandTime;
CMD:frplayeridparams[] )
{
    if (
gettime() - commandTime 120) return SendClientMessage(playerid, -1"Wait 2 minutes before you use this command again.")
    new 
rand random10 );
    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(playerid319999);
            
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(playerid123);
            
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(playerid10);
            
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(playeridGetPlayerScore(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(playerid95);
            
SendClientMessage(playerid,-1,""chat""COL_RED" You got Armor");
        }
    }
    return 
1;

Yup, it's work fine.
Reply


Messages In This Thread
How put timer in command - by henkas - 10.10.2016, 15:43
Re: How put timer in command - by ChristolisTV - 10.10.2016, 15:53
Re: How put timer in command - by Skimmer - 10.10.2016, 16:06
Re: How put timer in command - by henkas - 10.10.2016, 16:34

Forum Jump:


Users browsing this thread: 1 Guest(s)