Where do I actually store this uhm?
#1

Well, I've been trying to make that if player gets some score like 10, 11 dunno he will get awarded. I made a code but dunno where to store it. OnPlayerUpdate it will spam me a lot and I have something that it's not working tho.


OnPlayerUpdate
Original code:
PHP Code:
if(GetPlayerScore(playerid) == 11)
    {
        
GivePlayerMoney(playerid1000);
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"<!>Congradulations! You have reached 10 score and you have became Private 2!");
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"<!>You have been awarded with 1000$!");
        return 
1;
    } 

Other code that I've been given.

PHP Code:
forward TimerTick();
public 
TimerTick()
{
    for (new 
Lplayerid 0Lplayerid MAX_PLAYERSLplayerid++) 
    {
        if (!
IsPlayerConnected(Lplayerid)) continue; 
        if (
TenScore[Lplayerid]) continue; 
        if (
GetPlayerScore(Lplayerid) >= 11)
        {
            
GivePlayerMoney(Lplayerid1000);
            
SendClientMessage(LplayeridCOLOR_LIGHTBLUE"<!>Congradulations! You have reached 10 score and you have became Private 2!");
            
SendClientMessage(LplayeridCOLOR_LIGHTBLUE"<!>You have been awarded with 1000$!");
            
TenScore[Lplayerid] = true//Set the variable as 'true' so it doesn't start spamming next time.
        
}
        if (
GetPlayerScore(Lplayerid) >= 21)
        {
            
GivePlayerMoney(Lplayerid2000);
            
SendClientMessage(LplayeridCOLOR_LIGHTBLUE"<!>Congradulations! You have reached 20 score and you have became Private 2!");
            
SendClientMessage(LplayeridCOLOR_LIGHTBLUE"<!>You have been awarded with 2000$!");
            
TenScore[Lplayerid] = true//Set the variable as 'true' so it doesn't start spamming next time.
         
}
    }
    return 
true;

Reply


Messages In This Thread
Where do I actually store this uhm? - by Twinki1993 - 09.02.2012, 02:33
Re: Where do I actually store this uhm? - by [ABK]Antonio - 09.02.2012, 03:32

Forum Jump:


Users browsing this thread: 2 Guest(s)