help me, onplayerupdate
#1

Quote:

if(GetPlayerScore(playerid) ==1000)
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a General of the Army", Pname);
SendClientMessageToAll(COLOR_RED,str);
return 1;
}
else if(GetPlayerScore(playerid) ==500)//level 12
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a General", Pname);
SendClientMessageToAll(COLOR_DARKRED,str);
return 1;
}
if(GetPlayerScore(playerid) ==300)//level 11
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Major General", Pname);
SendClientMessageToAll(COLOR_DARKRED,str);
return 1;
}
else if(GetPlayerScore(playerid) ==250)//level 9
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Lieutenant General", Pname);
SendClientMessageToAll(COLOR_DARKRED,str);
return 1;
}
if(GetPlayerScore(playerid) ==190)//level 8
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Lieutenant Colonel", Pname);
SendClientMessageToAll(COLOR_RED,str);
return 1;
}
else if(GetPlayerScore(playerid) ==150)//level 7
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Colonel", Pname);
SendClientMessageToAll(COLOR_RED,str);
return 1;
}
if(GetPlayerScore(playerid) ==110)//level 6
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Major", Pname);
SendClientMessageToAll(COLOR_RED,str);
return 1;
}
else if(GetPlayerScore(playerid) ==80)//level 5
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Captain", Pname);
SendClientMessageToAll(COLOR_RED,str);
return 1;
}
if(GetPlayerScore(playerid) ==65)//level 4
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Lieutenant", Pname);
SendClientMessageToAll(COLOR_RED,str);
return 1;
}
else if(GetPlayerScore(playerid) ==45)//level 3
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Sergeant", Pname);
SendClientMessageToAll(COLOR_RED,str);
return 1;
}
if(GetPlayerScore(playerid) ==25)// level 2
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Corporal", Pname);
SendClientMessageToAll(COLOR_RED,str);
return 1;
}

i put that in onplayerupdate,

when i got 25 score
it always sendclientmessae over and over,,like spam

how to make it just once message send, if player get score

help me pls
Reply
#2

This is called loads if times per second, so it will show you the message loads of times per second. This is definitely a bed example of OnPlayerUpdate. How are you setting the players score anyway?
Reply
#3

pawn Код:
new NoSpam[(300+200)]; // at the top of the script

if(GetPlayerScore(playerid) ==1000 && NoSpam[playerid] == 0)
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a General of the Army", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
else if(GetPlayerScore(playerid) ==500 && NoSpam[playerid] == 0)//level 12
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a General", Pname);
SendClientMessageToAll(COLOR_DARKRED,str);
NoSpam[playerid] = 1;
return 1;
}
if(GetPlayerScore(playerid) ==300 && NoSpam[playerid] == 0)//level 11
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Major General", Pname);
SendClientMessageToAll(COLOR_DARKRED,str);
NoSpam[playerid] = 1;
return 1;
}
else if(GetPlayerScore(playerid) ==250)//level 9
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Lieutenant General", Pname);
SendClientMessageToAll(COLOR_DARKRED,str);
NoSpam[playerid] = 1;
return 1;
}
if(GetPlayerScore(playerid) ==190 && NoSpam[playerid] == 0)//level 8
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Lieutenant Colonel", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
else if(GetPlayerScore(playerid) ==150 && NoSpam[playerid] == 0)//level 7
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Colonel", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
if(GetPlayerScore(playerid) ==110 && NoSpam[playerid] == 0)//level 6
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Major", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
else if(GetPlayerScore(playerid) ==80 && NoSpam[playerid] == 0)//level 5
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Captain", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
if(GetPlayerScore(playerid) ==65 && NoSpam[playerid] == 0)//level 4
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Lieutenant", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
else if(GetPlayerScore(playerid) ==45 && NoSpam[playerid] == 0)//level 3
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Sergeant", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
if(GetPlayerScore(playerid) ==25 && NoSpam[playerid] == 0)// level 2
{

new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Corporal", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
Reply
#4

Quote:
Originally Posted by tour15
Посмотреть сообщение
pawn Код:
new NoSpam[(300+200)]; // at the top of the script

if(GetPlayerScore(playerid) ==1000 && NoSpam[playerid] == 0)
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a General of the Army", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
else if(GetPlayerScore(playerid) ==500 && NoSpam[playerid] == 0)//level 12
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a General", Pname);
SendClientMessageToAll(COLOR_DARKRED,str);
NoSpam[playerid] = 1;
return 1;
}
if(GetPlayerScore(playerid) ==300 && NoSpam[playerid] == 0)//level 11
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Major General", Pname);
SendClientMessageToAll(COLOR_DARKRED,str);
NoSpam[playerid] = 1;
return 1;
}
else if(GetPlayerScore(playerid) ==250)//level 9
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Lieutenant General", Pname);
SendClientMessageToAll(COLOR_DARKRED,str);
NoSpam[playerid] = 1;
return 1;
}
if(GetPlayerScore(playerid) ==190 && NoSpam[playerid] == 0)//level 8
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Lieutenant Colonel", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
else if(GetPlayerScore(playerid) ==150 && NoSpam[playerid] == 0)//level 7
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Colonel", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
if(GetPlayerScore(playerid) ==110 && NoSpam[playerid] == 0)//level 6
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Major", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
else if(GetPlayerScore(playerid) ==80 && NoSpam[playerid] == 0)//level 5
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Captain", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
if(GetPlayerScore(playerid) ==65 && NoSpam[playerid] == 0)//level 4
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Lieutenant", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
else if(GetPlayerScore(playerid) ==45 && NoSpam[playerid] == 0)//level 3
{
new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Sergeant", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
if(GetPlayerScore(playerid) ==25 && NoSpam[playerid] == 0)// level 2
{

new str[128], Pname[24];
GetPlayerName(playerid, Pname, 24);
format(str, sizeof(str), "News: %s Has been promoted to a Corporal", Pname);
SendClientMessageToAll(COLOR_RED,str);
NoSpam[playerid] = 1;
return 1;
}
thank u, u r awsome,,,

u know what, im newbie,,
hahaha


five thumbs for you
Reply
#5

tour15 forget one NoSpam[ playerid ];

pawn Код:
else if (GetPlayerScore(playerid) ==250)//level 9 ( wrong D: )

else if ( GetPlayerScore( playerid ) == 250 && NoSpam[ playerid ] == 0 ) // level 9 ( correct I think D: )
Sorry if I made a typo, nyancat makes my browser laggs.
Reply
#6

Quote:
Originally Posted by handerson
Посмотреть сообщение
thank u, u r awsome,,,

u know what, im newbie,,
hahaha


five thumbs for you
hehe i just helped.. Basicz thank you man i forgot it xD
Reply
#7

https://sampforum.blast.hk/showthread.php?tid=59771
Reply
#8

This isn't going to work, just so you know. You're blocking every upcoming promotion with that variable.
Also, you really shouldn't put that code OnPlayerUpdate. (A simple search would justify why.) - EDIT: snip.
-- Look down.
Reply
#9

pawn Код:
NoSpam[killerid] = 0; // under OnPlayerDeath
People dont panic with so simple solutions...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)