Help me with this, +rep if done.
#10

The loose indentation warnings are because of the formatting.

I messed up by placing a statement outside a case within the switch statement.
Move the line lastGift[playerid] = gettime() + 10800; below the bracket out of the switch statement.

The correct code should look like this.

PHP код:
#include<a_samp> 
#include<zcmd> 
public OnFilterScriptInit() 

    return 
1

public 
OnFilterScriptExit() 

    return 
1

new 
lastGift[MAX_PLAYERS]; 
COMMAND:getgift(playeridparams[]) 

    if(
gettime() < lastGift[playerid]) 
    { 
        new 
str[128]; 
        new 
timeLeft lastGift[playerid] - gettime(); 
        
format(strsizeof(str), "You can get another gift in %d hours and %d minutes."timeLeft 60timeLeft 60); 
        
SendClientMessage(playerid, -1str); 
        return 
1
    } 
    switch(
random(3)) 
    { 
        case 
0:  
        { 
            
GivePlayerMoney(playerid200); 
            
SendClientMessage(playerid, -1"You opened a give and received $200."); 
        } 
        case 
1:  
        { 
            
GivePlayerMoney(playerid500); 
            
SendClientMessage(playerid, -1"You opened a gift and received $500"); 
        } 
        case 
2:  
        {   
SetPlayerScore(playeridGetPlayerScore(playerid)+2); 
            
SendClientMessage(playerid, -1"You opened a gift and received score."); 
        } 
    } 
    
lastGift[playerid] = gettime() + 10800
    return 
1

Reply


Messages In This Thread
Help me with this, +rep if done. - by Oxygenated - 14.09.2017, 15:23
Re: Help me with this, +rep if done. - by DrVenomous - 14.09.2017, 15:35
Re: Help me with this, +rep if done. - by Ultraz - 14.09.2017, 15:53
Re: Help me with this, +rep if done. - by Oxygenated - 14.09.2017, 17:45
Re: Help me with this, +rep if done. - by Sew_Sumi - 15.09.2017, 00:46
Re: Help me with this, +rep if done. - by Oxygenated - 15.09.2017, 03:00
Re: Help me with this, +rep if done. - by StaticYey - 15.09.2017, 05:34
Re: Help me with this, +rep if done. - by Oxygenated - 15.09.2017, 07:44
Re: Help me with this, +rep if done. - by BadJih - 15.09.2017, 09:56
Re: Help me with this, +rep if done. - by StaticYey - 15.09.2017, 11:59

Forum Jump:


Users browsing this thread: 1 Guest(s)