Help,race - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help,race (
/showthread.php?tid=67558)
Help,race -
Gantzyo - 02.03.2009
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:
Код:
forward Countdown();
new CountDown = -1;
The command
Код:
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;
}
And the timer with the count
Код:
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;
}
Can someone help me please?