SetTimer - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetTimer (
/showthread.php?tid=286746)
SetTimer -
wumpyc - 30.09.2011
hey i made that
public OnGameModeInit()
{
SetTimer("message",20000,true);
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
SendClientMessage(playerid, 0x00FF00FF,"Click /seatbelt or pay!");
return 1;
}
forward message(playerid);
public message(playerid)
{
if(IsPlayerInAnyVehicle(playerid) == 1)
{
SendClientMessage(playerid,0xFF0000FF,"You didnt used seatbelt!");
}
return 1;
}
but after 20sec in veh nothing happen
help me pls
Re: SetTimer -
Raimis_R - 30.09.2011
pawn Code:
public OnGameModeInit()
{
SetTimer("message",20000,true);
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
SendClientMessage(playerid, 0x00FF00FF,"Click /seatbelt or pay!");
return 1;
}
forward message();
public message()
{
for(new playerid; playerid != MAX_PLAYERS; ++playerid)
{
if (!IsPlayerConnected(playerid))continue;
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,0xFF0000FF,"You didnt used seatbelt!");
}
}
return 1;
}
Re: SetTimer -
[Diablo] - 30.09.2011
raimis was faster
Re: SetTimer -
[MWR]Blood - 30.09.2011
pawn Code:
for(new playerid; playerid != MAX_PLAYERS; ++playerid)
Hell no!
Should be:
Code:
for(new playerid; playerid < MAX_PLAYERS; ++playerid)
Re: SetTimer -
Raimis_R - 30.09.2011
Quote:
Originally Posted by [MWR]Blood
pawn Code:
for(new playerid; playerid != MAX_PLAYERS; ++playerid)
Hell no!
Should be:
Code:
for(new playerid; playerid < MAX_PLAYERS; ++playerid)
|
Lol funny story...
I think you will post again so just test it:
pawn Code:
for( new ex; ex != 10; ++ex)
{
printf("Ex: %i", ex);
}
Code:
OUTPUT:
0
1
2
3
4
5
6
7
8
9
Next
pawn Code:
for( new ex; ex < 10; ++ex)
{
printf("Ex: %i", ex);
}
Code:
OUTPUT:
0
1
2
3
4
5
6
7
8
9
Re: SetTimer -
iggy1 - 30.09.2011
Quote:
Originally Posted by [MWR]Blood
pawn Code:
for(new playerid; playerid != MAX_PLAYERS; ++playerid)
Hell no!
Should be:
Code:
for(new playerid; playerid < MAX_PLAYERS; ++playerid)
|
Erm both are equivalent.
EDIT: Nvr realized it had already been pointed out.
Re: SetTimer -
SuperViper - 30.09.2011
How about
and
pawn Code:
foreach(Player, playerid) {
Re: SetTimer -
Raimis_R - 30.09.2011
For 1 loop i don't think is necessary need to use foreach