Vehicle Respawn problem
#1

Anyone knows how to set vehicle respawn off in this code? But only for spawned vehicles by admins not for static vehicles!

PHP код:
dcmd_v(playeridparams[])
{
    if(
IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] > 0)
    {
        new 
idx,modelid;
        new 
tmp[256],string[256];
        
tmp strtok(paramsidx);
        if(!
strlen(tmp))
        {
            
SendClientMessage(playeridCOLOR_ERROR"USAGE: /v (Modelid/Name)");
            return 
1;
        }
        
        
        if(
isNumeric(tmp))
        {
        
modelid strval(tmp);
        
        }else{
        
modelid GetVehicleModelIDFromNametmp );
        if( 
modelid == -)
        {
        
SendClientMessage(playeridCOLOR_ERROR"[ERROR] Invalid MODELID/NAME");
        return 
1;
        }
        }
        if(
modelid 400 || modelid 611)
        {
        
SendClientMessage(playeridCOLOR_ERROR"Enter A Vehicle Modelid Between 400 And 611");
        return 
1;
        }
        new 
Float:XFloat:YFloat:ZFloat:A;//,Interior,World;
        
GetPlayerPos(playeridXYZ);
        
GetPlayerFacingAngle(playeridA);
        
//Interior = GetPlayerInterior(playerid);
        //World = GetPlayerVirtualWorld(playerid);
        
GetXYInFrontOfPlayer(playeridXY5.0);
        
CreateVehicle(modelidX,Y,2.0,90.0,-1,-1,1000);
        
format(stringsizeof(string), "%s Spawned A (%s), Modelid: (%d)"PlayerInfo[playerid][pName], aVehicleNames[modelid 400], modelid);
}else{
    
SendClientMessage(playeridCOLOR_ERROR"Unknown Command! Type /cmds For Available Commands.");
    }
    return 
1;

PHP код:
public OnVehicleDeath(vehicleidkillerid)
{
    new 
string[256];
    if (
CarInfo[vehicleid][cOwned] > -1)
    {
    new 
playerid CarInfo[vehicleid][cOwned];
    
PlayerInfo[playerid][pCar] = 0;
    }
    
format(stringsizeof(string), "Not Owned");
    
strmid(CarInfo[vehicleid][cOwner], string0strlen(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(stringsizeof(string), "Not Owned");
    
strmid(CarInfo[vehicleid][cOwner], string0strlen(string), 256);
    
CarInfo[vehicleid][cOwned] = -1;
    
CarInfo[vehicleid][cLock] = 0;
    
CarInfo[vehicleid][cSold] = 0;
    
CarInfo[vehicleid][cValue] = 0;
    return 
1;

What should I add and where?
Reputation included for help
Reply
#2

here is the format CreateVehicle.
Код:
(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0)
using -1 in respawn_delay will prevent the vehicle from respawning.
PHP код:
CreateVehicle(modelidX,Y,2.0,90.0,-1,-1,1000);//use -1 instead of 1000 here 
PHP код:
CreateVehicle(modelidX,Y,2.0,90.0,-1,-1,-1); //changed to -1 
Reply
#3

Quote:
Originally Posted by Zedder
Посмотреть сообщение
here is the format CreateVehicle.
Код:
(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0)
using -1 in respawn_delay will prevent the vehicle from respawning.
PHP код:
CreateVehicle(modelidX,Y,2.0,90.0,-1,-1,1000);//use -1 instead of 1000 here 
PHP код:
CreateVehicle(modelidX,Y,2.0,90.0,-1,-1,-1); //changed to -1 
It's still getting spawned... I tried also change -1 to
PHP код:
CreateVehicle(modelidX,Y,2.0,90.0,-1,-1,604800); 
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)