12.09.2009, 19:15
Oke after a lot of fail's, I've managed to get the script working...
...there is jsut one thing that doesn't work. The player should be frozen for a specific amount of time. This works, but he isn't unfrozen after that time.
Here what I put on top of the script:
And here the functions:
Everything else works fine.
...there is jsut one thing that doesn't work. The player should be frozen for a specific amount of time. This works, but he isn't unfrozen after that time.
Here what I put on top of the script:
pawn Код:
new RespawnDelay = 100; //The time the player will be frozen after respawned in ms.
new RespawnTimer; //DO NOT CHANGE!!!
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(RaceParticipant[playerid] == 4)
{
if (EnableRespawn == 1)
{
new model = (GetVehicleModel(vehicleid));
SetPlayerHealth(playerid, 100.0);
SetRaceCheckpoint(playerid, CurrentCheckpoint[playerid]-1 ,CurrentCheckpoint[playerid]);
DestroyVehicle(vehicleid);
SetPlayerPos(playerid, lastCPx, lastCPy, lastCPz);
new currentvehicleID = CreateVehicle(model, lastCPx, lastCPy, lastCPz, lastCPa, 2, 4, 600);
PutPlayerInVehicle(playerid, currentvehicleID, 0);
RespawnTimer = SetTimer("RespawnFreeze", RespawnDelay, false);
TogglePlayerControllable(playerid,0);
}
}
return 1;
}
stock RespawnFreeze(playerid)
{
TogglePlayerControllable(playerid,1);
KillTimer(RespawnTimer);
}