respawn 1 vehicle
#1

Hey, asking the community for a hand with something. I need to make a command that will respawn one car by id (/r id) i mean the id that is from /dl . I know how to respawn all vehicles, or a person model id but can someone give me some pointers on how to do this
Thanks. Of course i will +rep you if you help me
Reply
#2

Something like that?
Код:
if(IsPlayerInAnyVehicle(playerid))
{
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_GREY, "Vehicle Respawned!");
}
Reply
#3

You Need sscanf.
PHP код:
CMD:svplayeridparams[ ] )
{
    static
        
vehID
    
;
    if ( 
sscanfparams"i",  vehID ) )
        return 
SendClientMessageplayeridCOLOR_RED"SYNTAX: /sv < vehID >" );
    if ( 
vehID == INVALID_VEHICLE_ID )
        return 
SendClientMessageplayeridCOLOR_RED"ERROR: Invalid vehicle ID." );
    
SetVehicleToRespawnvehID );
    
SendClientMessageplayeridCOLOR_RED"Vehicle has been respawned succesfully." );
    return 
1;

Reply
#4

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
You Need sscanf.

Not really you can do it with "SetVehicleToRespawn"

Edit: From A_SAMP
Reply
#5

I had no luck with that, do i need to get the vehicle id first?
Reply
#6

Quote:
Originally Posted by Stu1
Посмотреть сообщение
I had no luck with that, do i need to get the vehicle id first?
Yes because or else system won't know which vehicle you want!
Reply
#7

Thats the bit i had a problem with! I can only get a vehicle id that a player is using and i Dont need that
Reply
#8

Quote:
Originally Posted by Stu1
Посмотреть сообщение
Thats the bit i had a problem with! I can only get a vehicle id that a player is using and i Dont need that
You want something like this?

PHP код:
if(strcmp(cmd"/rac"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pAdmin] < 1337)
            {
                
SendClientMessage(playeridCOLOR_GRAD1" You are not authorized to use that command");
                return 
1;
            }
            new 
bool:unwanted[CAR_AMOUNT];
            for(new 
player=0player<MAX_PLAYERSplayer++)
             {
                if(
IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
             }
            for(new 
car 1car <= 699car++)
            {
                if(!
unwanted[car]) SetVehicleToRespawn(car);
            }
            
format(stringsizeof(string), "AdmWarning: %s(%d) has respawned all the cars!"sendername,playerid);
            
ABroadCast(COLOR_LIGHTRED,string1);
        }
        return 
1;
    } 
Reply
#9

That will restore all cars though right? I'm looking to do just the one, say a player finds a car or trailer blocking the road he/she can go /dl get the id and tell a admin to restore it. With /r [vehicleid]
Reply
#10

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
You Need sscanf.
PHP код:
CMD:svplayeridparams[ ] )
{
    static
        
vehID
    
;
    if ( 
sscanfparams"i",  vehID ) )
        return 
SendClientMessageplayeridCOLOR_RED"SYNTAX: /sv < vehID >" );
    if ( 
vehID == INVALID_VEHICLE_ID )
        return 
SendClientMessageplayeridCOLOR_RED"ERROR: Invalid vehicle ID." );
    
SetVehicleToRespawnvehID );
    
SendClientMessageplayeridCOLOR_RED"Vehicle has been respawned succesfully." );
    return 
1;

DO this one
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)