21.09.2017, 14:17
Anyone knows how to set vehicle respawn off in this code? But only for spawned vehicles by admins not for static vehicles!
What should I add and where?
Reputation included for help
PHP код:
dcmd_v(playerid, params[])
{
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 0)
{
new idx,modelid;
new tmp[256],string[256];
tmp = strtok(params, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /v (Modelid/Name)");
return 1;
}
if(isNumeric(tmp))
{
modelid = strval(tmp);
}else{
modelid = GetVehicleModelIDFromName( tmp );
if( modelid == -1 )
{
SendClientMessage(playerid, COLOR_ERROR, "[ERROR] Invalid MODELID/NAME");
return 1;
}
}
if(modelid < 400 || modelid > 611)
{
SendClientMessage(playerid, COLOR_ERROR, "Enter A Vehicle Modelid Between 400 And 611");
return 1;
}
new Float:X, Float:Y, Float:Z, Float:A;//,Interior,World;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
//Interior = GetPlayerInterior(playerid);
//World = GetPlayerVirtualWorld(playerid);
GetXYInFrontOfPlayer(playerid, X, Y, 5.0);
CreateVehicle(modelid, X,Y,Z + 2.0,A + 90.0,-1,-1,1000);
format(string, sizeof(string), "%s Spawned A (%s), Modelid: (%d)", PlayerInfo[playerid][pName], aVehicleNames[modelid - 400], modelid);
}else{
SendClientMessage(playerid, COLOR_ERROR, "Unknown Command! Type /cmds For Available Commands.");
}
return 1;
}
PHP код:
public OnVehicleDeath(vehicleid, killerid)
{
new string[256];
if (CarInfo[vehicleid][cOwned] > -1)
{
new playerid = CarInfo[vehicleid][cOwned];
PlayerInfo[playerid][pCar] = 0;
}
format(string, sizeof(string), "Not Owned");
strmid(CarInfo[vehicleid][cOwner], string, 0, strlen(string), 256);
CarInfo[vehicleid][cOwned] = -1;
CarInfo[vehicleid][cLock] = 0;
CarInfo[vehicleid][cSold] = 0;
CarInfo[vehicleid][cValue] = 0;
return 1;
}
PHP код:
public OnVehicleSpawn(vehicleid)
{
new string[256];
if (CarInfo[vehicleid][cOwned] > -1)
{
new playerid = CarInfo[vehicleid][cOwned];
PlayerInfo[playerid][pCar] = 0;
}
format(string, sizeof(string), "Not Owned");
strmid(CarInfo[vehicleid][cOwner], string, 0, strlen(string), 256);
CarInfo[vehicleid][cOwned] = -1;
CarInfo[vehicleid][cLock] = 0;
CarInfo[vehicleid][cSold] = 0;
CarInfo[vehicleid][cValue] = 0;
return 1;
}
Reputation included for help