public CheckPlayers()
{
if(RaceStarted == 0)
{
if(GetOnlinePlayers() > 1)
{
SetTimer("Countdown", 1000, 0);
RaceStarted = 1;
GameTextForAll("~w~Race starting in...", 1000, 4);
}
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
if(RaceStarted == 0)
{
TogglePlayerControllable(playerid, 0);
SetTimer("CheckPlayers", 5000, 1);
}
}
return 1;
}
Originally Posted by Joe Torran C
Hello,
Im trying to make a race script, And ive run into a little problem with the countdown, What i want it to do is, Check if theres more than 1 player online, If there is. It will start a timer. But when theres 2 people online my server, I never see the countdown? This is my code: (Unfinished) pawn Код:
pawn Код:
|
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { if(RaceStarted == 1) { TogglePlayerControllable(playerid, 0); SetTimer("CheckPlayers", 5000, 1); } } return 1; } |
Originally Posted by DJDhan
Well, you need to show the countdown function coz the problem is there isn't it?
|
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { if(RaceStarted == 1) { TogglePlayerControllable(playerid, 0); SetTimer("CheckPlayers", 5000, 1); } } return 1; } |
Originally Posted by DJDhan
Well, you need to show the countdown function coz the problem is there isn't it?
|
Originally Posted by Ihsan_Cingisiz
I think you need to do this..
Quote:
|
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER) { if(RaceStarted == 0) { TogglePlayerControllable(playerid, 0); SetTimer("CheckPlayers", 5000, 1); } } return 1; }
SetTimer("CheckPlayers", 5000, 1);
Originally Posted by MadeMan
pawn Код:
|
public OnPlayerSpawn(playerid)
{
if(RaceStarted == 0)
{
for(new i = 0; i<MAX_VEHICLES; i++)
{
for(new i2 = 0; i2<MAX_PLAYERS; i2++)
{
if(IsPlayerInVehicle(i2, i))
{
return 1;
}
}
PutPlayerInVehicle(playerid, i, 0);
}
}
return 1;
}