PHP код:
enum pInfo
{
pVehicle
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][pVehicle] = INVALID_VEHICLE_ID;
}
&
public OnPlayerDisconnect(playerid, reason)
{
DestroyVehicle(PlayerInfo[playerid][pVehicle]);
PlayerInfo[playerid][pVehicle] = INVALID_VEHICLE_ID;
}
CreateXVehicle2(playerid, modelid)
{
new Float:x,Float:y,Float:z,Float:angulo;
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, angulo);
if(PlayerInfo[playerid][pVehicle] != INVALID_VEHICLE_ID) DestroyVehicle(PlayerInfo[playerid][pVehicle]);
PlayerInfo[playerid][pVehicle] = CreateVehicle(modelid,x+0.5,y+3,z,angulo,-1,-1,9000);
printf("2. playerid:%d ----- SpawnedVehicle:%d -----",playerid,PlayerInfo[playerid][pVehicle]);
return 1;
}