Can't get this to work for the life of me
#8

Quote:
Originally Posted by runcis
Посмотреть сообщение
And what about sscanf?

Like cmd gives the vehicle's id. /towcar [VEHICLEID],
so, command works with id that's given.

And you probably right.

-------

Probably cmd won't work, because you have static vehicles too, like police n shit, well, I guess when you enter car's id, you entered the id of mysql cars list.

Try:
PHP код:
CMD:towcar(playeridparams[])
{
    new 
vehicleid;
    if (
sscanf(params"d"vehicleid))
        return 
SendSyntaxMessage(playerid"/towcar [veh]");
        
    if (
vehicleid || vehicleid MAX_VEHICLES || !IsValidVehicle(vehicleid))
        return 
SendErrorMessage(playerid"You have specified an invalid vehicle ID.");
    
id Car_GetID(vehicleid);
        
    if (
Car_IsOwner(playeridid)) {
        
RespawnVehicle(id);
        
Car_Save(id);
        
SendServerMessage(playerid"You have respawned vehicle ID: %d."id);
        
GiveMoney(playerid, -500);
    } else {
        
SendErrorMessage(playerid"You cannot respawn a car that you do not own."); 
    }
    return 
1;

The fact there are static vehicles should not effect the command, this command is basically a clone of the /respawncar [id] command except on /towcar it checks that the player owns the vehicle.

I will try your solution
Reply


Messages In This Thread
Can't get this to work for the life of me - by Luke_James - 22.08.2015, 18:22
Re: Can't get this to work for the life of me - by thaKing - 22.08.2015, 18:28
Re: Can't get this to work for the life of me - by Luke_James - 22.08.2015, 18:32
Re: Can't get this to work for the life of me - by thaKing - 22.08.2015, 18:50
Re: Can't get this to work for the life of me - by Bingo - 22.08.2015, 18:56
Re: Can't get this to work for the life of me - by thaKing - 22.08.2015, 19:04
Re: Can't get this to work for the life of me - by Luke_James - 22.08.2015, 19:51
Re: Can't get this to work for the life of me - by Luke_James - 22.08.2015, 19:53

Forum Jump:


Users browsing this thread: 1 Guest(s)