Changing car model ID [HELP]
#1

I want to make a command /setcarmodel, and I need help.

And is there such a thing in scripting as in SetCarModel?
Reply
#2

There is no such a function. You need to destroy and then recreate the vehicle with a new model id
If you mean the command that changes the model of the vehicle you are currently in, then here's it:
pawn Код:
cmd(setcarmodel, playerid, params[])
{
    new model;
    if(sscanf(params,"i",model)) SendClientMessage(playerid, 0xFFFFFFFF, "You haven't specified the model id");
    else
    {
                new Float:x, Float:y, Float:z, Float:a, id;
                id = GetPlayerVehicleID(playerid);
                GetVehicleZAngle(id, a);
                GetVehiclePos(id, x, y, z);
                RemovePlayerFromVehicle(playerid);
                DestroyVehicle(id);
                id = CreateVehicle(model, x, y, z, a, -1, -1, 999999);
                PutPlayerInVehicle(playerid, id, 0);
    }
    return 1;
}
You need zcmd and sscanf for this command to work
Reply
#3

I found this one..works great i hope you can use it;

Код:
stock SetVehicleModel(playerid,vehicleid, model)
{
	new Float:vX, Float:vY, Float:vZ;
	new color=random(50);
	new Float:Angle;
	new Float:vehX, Float:vehY, Float:vehZ;
	GetVehicleZAngle(vehicleid,Angle);
	GetVehiclePos(vehicleid,vehX, vehY, vehZ);
	GetVehicleVelocity(vehicleid, vX, vY, vZ);
	DestroyVehicle(vehicleid);
	new Create=CreateVehicle(model, vehX, vehY, vehZ,Angle,color, color, 99999);
	PutPlayerInVehicle(playerid, vehicleid, 0);
	SetVehicleVelocity(Create,vX, vY, vZ);
}
Reply
#4

Thanks guys, really helped. I use the old way of using PAWN. EX: command(help, playerid, params[])
Reply
#5

Quote:
Originally Posted by Dennis
Посмотреть сообщение
Thanks guys, really helped. I use the old way of using PAWN. EX: command(help, playerid, params[])
That's not the 'old way', that's zcmd and it's relatively new in comparison to dcmd or the old strtok methods.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)