Returning to ID 0 for some reason... -
Lars_Frederiksen - 29.11.2010
I was just wondering, this was working at one point, can somebody tell me why this is only working for ID 0?
pawn Код:
new string[128];
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
PlayerInfo[i][pCheck] = 1;
CheckNumber[i] = 1000+random(8999);
format(string, 128, "Type /signcheck %d to receive your paycheck.", CheckNumber[i]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck");
GameTextForPlayer(i, string, 5000, 1);
}
}
Re: Returning to ID 0 for some reason... -
Lars_Frederiksen - 29.11.2010
I try this
pawn Код:
public PayCheck()
{
new string[128];
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pCheck] == 1)
{
CheckNumber[i] = 1000+random(8999);
format(string, 128, "Type /signcheck %d to receive your paycheck.", CheckNumber[i]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck");
GameTextForPlayer(i, string, 5000, 1);
return 1;
}
}
}
return 1;
}
And then it will give everyone a paycheck but say theres 3 people on. it will show that message 3 times, say there is 6 people on it will spam the message 6 times, it doesn't make any sense.
Re: Returning to ID 0 for some reason... -
bigcomfycouch - 29.11.2010
http://pastebin.ca/2005021
Re: Returning to ID 0 for some reason... -
Lars_Frederiksen - 29.11.2010
Thanks bcc, Ian Stuart btw.
Re: Returning to ID 0 for some reason... -
Lars_Frederiksen - 29.11.2010
Okay well I tried your code, everytime I type /payday nothing happens, and only ID 0 is getting a paycheck, when I had it set up how i did on my last reply, it would give people a payday, but it would spam it....
Re: Returning to ID 0 for some reason... -
bigcomfycouch - 29.11.2010
Your prior code was simply sending the message for ID 0 to everybody. Are you still halting the loop by returning?
Re: Returning to ID 0 for some reason... -
Lars_Frederiksen - 29.11.2010
Well I removed the /signcheck system and replaced it with the original paycheck. Anyways what my question is. Why would the normal paycheck work and not the /signcheck message? Makes no sense.
Re: Returning to ID 0 for some reason... -
JaTochNietDan - 29.11.2010
Because you have this in a loop.
pawn Код:
format(string, 128, "Type /signcheck %d to receive your paycheck.", CheckNumber[i]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
The loop is running 499 times and the message will be sent
to everyone everytime a player is online according to your code. What you need to quite simply do, is change
SendClientMessageToAll
to
SendClientMessageToPlayer(i,COLOR_LIGHTBLUE,string );