OnPlayerEnter&ExitVehcile -
Super_Panda - 26.12.2011
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
SetTimer("message", 30000, false);
return 1;
}
forward message(playerid);
public message(playerid)
{
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
DestroyVehicle(currentveh);
new name[MAX_PLAYER_NAME], string[124+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Se ha destruнdo el vehнculo de %s despues de 30 segundos de espera.", name);
print(string);
}
I want that if the player gets out of the car then destroy the car, but if the player gets back to the car then keep it.
Re: OnPlayerEnter&ExitVehcile -
coole210 - 26.12.2011
Код:
//TOP:
new msgtimer[MAX_PLAYERS];
//
public OnPlayerExitVehicle(playerid, vehicleid)
{
SendClientMessage(playerid,-1,"You have 30 seconds to get back in the car !");
msgtimer[playerid] = SetTimerEx("message",30000,false,"dd",playerid,vehicleid);
return 1;
}
forward message(playerid,vehicleid);
public message(playerid,vehicleid)
{
if(GetPlayerVehicleID(playerid) != vehicleid)
{
DestroyVehicle(vehicleid);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
print("Se ha destruнdo el vehнculo de %s despues de 30 segundos de espera.",name);
}
else
{
KillTimer(msgtimer[playerid]);
}
return 1;
}
code fixed
Respuesta: OnPlayerEnter&ExitVehcile -
Jovanny - 27.12.2011
pawn Код:
//TOP:
new msgtimer[MAX_PLAYERS];
//
public OnPlayerExitVehicle(playerid, vehicleid)
{
SendClientMessage(playerid,-1,"You have 30 seconds to get back in the car !");
msgtimer[playerid] = SetTimerEx("message",30000,false,"dd",playerid,vehicleid);
return 1;
}
forward message(playerid,vehicleid);
public message(playerid,vehicleid)
{
if(GetPlayerVehicleID(playerid) != vehicleid)
{
DestroyVehicle(vehicleid);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
printf("Se ha destruнdo el vehнculo de %s despues de 30 segundos de espera.",name);
}
else
{
KillTimer(msgtimer[playerid]);
}
return 1;
}
is "printf" no "print"
EDIT: Super Panda, you can ask for help in Spanish section and we will help, I speak Spanish, speak little English
Re: OnPlayerEnter&ExitVehcile -
Ballu Miaa - 27.12.2011
I want to write in Caps but i wont!! Use CreateVehicle(ModelID,X,Y,Z,Angle,Color1,Color2,Re spawnDelayinMs);
Use this function under OnGameModeInIt as an example!
pawn Код:
CreateVehicle(522,456.134,7945.45,4855.3666,208.456,172,172,5 * 60 * 1000);
This code will add a NRG500 With Purple color on given X,Y,Z with Angle and it will respawn when a player is not driving it till 5 Minutes. If the player come's back in it auto cancel's the respawn!
No use of any other function!