02.03.2009, 10:52
Hi, i have got a problem with a race.I did 2 cars for the Drag race, but the player in the 1st car, can't move.This is my code:
The command
And the timer with the count
Can someone help me please?
Код:
forward Countdown(); new CountDown = -1;
Код:
if(strcmp(cmd, "/drag", true) == 0)
{
if(PInfo[playerid][in_race] == 0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
SetPlayerPos(playerid,X,Y,Z+10);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i,drag1))
{
PutPlayerInVehicle(playerid,drag2,0);
SetPlayerCheckpoint(playerid,3200.5352,-2728.3928,5.9054,15);
PInfo[playerid][in_race] = 1;
TogglePlayerControllable(playerid,false);
if(CountDown == -1)
{
CountDown = 6;
SetTimer("Countdown",1000,0);
}
}
else
{
PutPlayerInVehicle(playerid,drag1,0);
SetPlayerCheckpoint(playerid,3200.5352,-2728.3928,5.9054,15);
PInfo[playerid][in_race] = 1;
TogglePlayerControllable(playerid,false);
}
}
if(PInfo[playerid][in_race] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "This is the drag race.Type /drag for leave the race.");
}
if(PInfo[playerid][in_race] == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "Sorry, the race is started, can't join.");
}
}
else
{
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
SpawnPlayer(playerid);
SendClientMessage(playerid, COLOR_YELLOW, "You leave the race.");
}
return 1;
}
Код:
public Countdown()
{
if(CountDown==6) GameTextForAll(" ",10000,3);
CountDown--;
for(new i = 0;i < MAX_PLAYERS;i++)
{
if(CountDown == 0)
{
if(PInfo[playerid][in_race] == 1)
{
GameTextForPlayer(i,"~r~go!",1000,6);
PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
TogglePlayerControllable(i,true);
CountDown = -1;
return 1;
}
}
else
{
new text[7];
if(PInfo[playerid][in_race] == 1)
{
format(text,sizeof(text),"~b~%d",CountDown);
PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
GameTextForPlayer(i,text,1000,3);
}
}
}
SetTimer("Countdown",1000,0);
return 0;
}

