Changing car model ID [HELP] - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Changing car model ID [HELP] (
/showthread.php?tid=180865)
Changing car model ID [HELP] -
Dennis - 03.10.2010
I want to make a command /setcarmodel, and I need help.
And is there such a thing in scripting as in SetCarModel?
Re: Changing car model ID [HELP] -
CracK - 03.10.2010
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
Re: Changing car model ID [HELP] -
boelie - 03.10.2010
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);
}
Re: Changing car model ID [HELP] -
Dennis - 03.10.2010
Thanks guys, really helped. I use the old way of using PAWN. EX: command(help, playerid, params[])
Re: Changing car model ID [HELP] -
Calgon - 03.10.2010
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.