A SendClientMessageToAll spam, any idea? -
denNorske - 04.10.2012
Here is my code that is my derby, with the "endDerby" function which should spawn a player, Destroy the derby car, and send a message to all that the derby is ended, and it will start again soon. Anyhow, here is my code:
When he joins the derby, this is started:
pawn Код:
timerr[i][EDERBY] = SetTimer("EndDerby", 60*1000, false);
endderby here:
pawn Код:
forward EndDerby(playerid);
public EndDerby(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPVarInt(playerid,"derby") == 1)
{
DestroyVehicle(GetPlayerVehicleID(playerid));
SpawnPlayer(playerid);
EnableDerby = 0;
SetPVarInt(playerid,"derby", 0);
}
else
{
EnableDerby = 0;
SetPVarInt(playerid,"derby", 0);
SetPVarInt(playerid, "HasSpawnedCar",0);
timerr[playerid][DTIMER] = SetTimer("StartDerby", 120000, false);
SendClientMessageToAll(COLOR_GREEN,"[SERVER] Derby has been ended!"cyellow" Everyone in derby has been spawned!");
SendClientMessageToAll(COLOR_GREEN,"[SERVER] New derby will be there in "cred"2 minutes!"cgreen" Kindly stay connected!");
KillTimer(timerr[playerid][EDERBY]);
KillTimer(timerr[playerid][STIMER]);
}
}
return 1;
}
That was the code, Why is this happening: ?
And another problem, when other players are driving their cars, suddenly all used cars are getting destroyed when the derby ends? I have struggled with that a long time now, i think it was time to get some help ^^
Thanks!
Re: A SendClientMessageToAll spam, any idea? -
Danyal - 04.10.2012
pawn Код:
forward EndDerby(playerid);
public EndDerby(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPVarInt(playerid,"derby") == 1)
{
DestroyVehicle(GetPlayerVehicleID(playerid));
SpawnPlayer(playerid);
EnableDerby = 0;
SetPVarInt(playerid,"derby", 0);
}
else
{
EnableDerby = 0;
SetPVarInt(playerid,"derby", 0);
SetPVarInt(playerid, "HasSpawnedCar",0);
timerr[playerid][DTIMER] = SetTimer("StartDerby", 120000, false);
SendClientMessage(i, COLOR_GREEN,"[SERVER] Derby has been ended!"cyellow" Everyone in derby has been spawned!");
SendClientMessage(i, COLOR_GREEN,"[SERVER] New derby will be there in "cred"2 minutes!"cgreen" Kindly stay connected!");
KillTimer(timerr[playerid][EDERBY]);
KillTimer(timerr[playerid][STIMER]);
}
}
return 1;
}
try this
Re: A SendClientMessageToAll spam, any idea? -
denNorske - 04.10.2012
Still the same
Anything to do with my loop at top ?
Re: A SendClientMessageToAll spam, any idea? -
C00K13M0N$73R - 04.10.2012
It sends a message to all 'MAX_PLAYERS' times.
Put it out of the loop.
pawn Код:
forward EndDerby(playerid);
public EndDerby(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetPVarInt(playerid,"derby") == 1)
{
DestroyVehicle(GetPlayerVehicleID(playerid));
SpawnPlayer(playerid);
EnableDerby = 0;
SetPVarInt(playerid,"derby", 0);
}
else
{
EnableDerby = 0;
SetPVarInt(playerid,"derby", 0);
SetPVarInt(playerid, "HasSpawnedCar",0);
timerr[playerid][DTIMER] = SetTimer("StartDerby", 120000, false);
KillTimer(timerr[playerid][EDERBY]);
KillTimer(timerr[playerid][STIMER]);
}
}
SendClientMessageToAll(COLOR_GREEN,"[SERVER] Derby has been ended!"cyellow" Everyone in derby has been spawned!");
SendClientMessageToAll(COLOR_GREEN,"[SERVER] New derby will be there in "cred"2 minutes!"cgreen" Kindly stay connected!");
return 1;
}
Re: A SendClientMessageToAll spam, any idea? -
denNorske - 04.10.2012
Still spamming me. Any other suggestions? Thanks!
Re: A SendClientMessageToAll spam, any idea? -
denNorske - 09.10.2012
Buuuuuump. Anyone?
Re: A SendClientMessageToAll spam, any idea? -
ViniBorn - 09.10.2012
Use SetTimerEx for function with parameters, and not SetTimer
Ex:
pawn Код:
SetTimerEx("EndDerby",60*1000,false, "i", playerid);
Re: A SendClientMessageToAll spam, any idea? -
denNorske - 09.10.2012
The timer works well, its just that the SendClientMessageToAll lines that spams the chat in game. 100 times within 5 -6 seconds.
Re: A SendClientMessageToAll spam, any idea? -
BlueGames - 09.10.2012
Try ?
pawn Код:
new string[265]
format(string,sizeof(string),"[SERVER] Derby has been ended!"cyellow" Everyone in derby has been spawned!",tmp);*
Re: A SendClientMessageToAll spam, any idea? -
denNorske - 09.10.2012
Sorry, still spamming me down when it ends :/