29.08.2012, 15:50
I wanted to create achievements for my racing gamemode .
I dont know whats wrong but when someone reaches 100 score,the chat is being spammed by the custom messages and he receives his money more than he should to.
pawn Код:
OnPlayerUpdate(playerid)
{
new string[100];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
if(GetPlayerScore(playerid) >=100)
{
format(string,sizeof(string),"%s reached 100 score and received 100,000$",pname);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid, 100000);
}
if(GetPlayerScore(playerid) >=250)
{
format(string,sizeof(string),"%s reached 250 score and received 250,000$",pname);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid, 250000);
}
if(GetPlayerScore(playerid) >=500)
{
format(string,sizeof(string),"%s reached 500 score and received 500,000$,and VIP status",pname);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid, 500000);
}
if(GetPlayerScore(playerid) >=1000)
{
format(string,sizeof(string),"%s reached 1000 score and received 1,000,000$",pname);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid, 1000000);
}
if(GetPlayerScore(playerid) >=2500)
{
format(string,sizeof(string),"%s reached 250 score and received 2,500,000$",pname);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid, 2500000);
}
if(GetPlayerScore(playerid) >=5000)
{
format(string,sizeof(string),"%s reached 500 score and received 5,000,000$",pname);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid, 250000);
}
if(GetPlayerScore(playerid) >=10000)
{
format(string,sizeof(string),"%s reached 10000 score and received 10,000,000%",pname);
SendClientMessageToAll(COLOR_LIGHTBLUE,string);
GivePlayerMoney(playerid, 10000000);
}
return 1;
}
pawn Код:
CMD:achievements(playerid,params[])
{
//SendClientMessage(playerid,COLOR_RED,"This page is under construction");
ShowPlayerDialog(playerid, 95, DIALOG_STYLE_MSGBOX, "Achievement Menu","Achievement - Reward - Special\n100 score - 100,000$\n 250 score - 250,000$ 500 score - 500,000 - VIP\n 1000 score - 1,000,000$\n 2500 score - 2,500,000$\n5000 score - 5,000,000$\n 10000 score - 10,000,000","OK","");
return 1;
}