09.02.2012, 02:33
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:
Other code that I've been given.
OnPlayerUpdate
Original code:
PHP Code:
if(GetPlayerScore(playerid) == 11)
{
GivePlayerMoney(playerid, 1000);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "<!>Congradulations! You have reached 10 score and you have became Private 2!");
SendClientMessage(playerid, COLOR_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 = 0; Lplayerid < MAX_PLAYERS; Lplayerid++)
{
if (!IsPlayerConnected(Lplayerid)) continue;
if (TenScore[Lplayerid]) continue;
if (GetPlayerScore(Lplayerid) >= 11)
{
GivePlayerMoney(Lplayerid, 1000);
SendClientMessage(Lplayerid, COLOR_LIGHTBLUE, "<!>Congradulations! You have reached 10 score and you have became Private 2!");
SendClientMessage(Lplayerid, COLOR_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(Lplayerid, 2000);
SendClientMessage(Lplayerid, COLOR_LIGHTBLUE, "<!>Congradulations! You have reached 20 score and you have became Private 2!");
SendClientMessage(Lplayerid, COLOR_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;
}