26.09.2010, 20:22
(
Последний раз редактировалось Rzzr; 27.09.2010 в 11:59.
)
/cvm - Change Vehicle Model
With this command you can 'change' your vehicle model with /cvm <vehicle name>.
Basically it creates a new vehicle, puts you in it and sets back your old speed using SetVehicleVelocity and you old angle. It looks like the vehicle model changes.
You also need the codes GetVehicleModelIDFromName and the vehicle name list, which I took from fsdebug, so credits to who made that. You can find those here: http://pastebin.com/17CYGReZ
Have fun with it!
pawn Код:
command(cvm, playerid, params[])
{
new vehicle[128];
if(sscanf(params, "s", vehicle)) SendClientMessage(playerid, 0xAA3333AA, "USAGE: /cvm <vehicle>");
else if(GetVehicleModelIDFromName(vehicle) < 400 || GetVehicleModelIDFromName(vehicle) > 611) SendClientMessage(playerid, 0xAA3333AA, "ERROR: Invalid vehicleid");
else if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) SendClientMessage(playerid, 0xAA3333AA, "ERROR: You must be in a vehicle!");
else
{
new Float: VelocityX, Float: VelocityY, Float: VelocityZ, Float: VehAngle, Float: PlayerX, Float: PlayerY, Float: PlayerZ, newveh;
GetVehicleVelocity(GetPlayerVehicleID(playerid), VelocityX, VelocityY, VelocityZ);
GetVehicleZAngle(GetPlayerVehicleID(playerid), VehAngle);
GetVehiclePos(GetPlayerVehicleID(playerid), PlayerX, PlayerY, PlayerZ);
DestroyVehicle(GetPlayerVehicleID(playerid));
newveh = CreateVehicle(GetVehicleModelIDFromName(vehicle), PlayerX, PlayerY, PlayerZ, VehAngle, -1, -1, 10);
PutPlayerInVehicle(playerid, newveh, 0);
SetVehicleVelocity(newveh, VelocityX*1.1, VelocityY*1.1, VelocityZ*1.1);
LinkVehicleToInterior(newveh, GetPlayerInterior(playerid));
SetVehicleVirtualWorld(newveh, GetPlayerVirtualWorld(playerid));
}
return 1;
}
Basically it creates a new vehicle, puts you in it and sets back your old speed using SetVehicleVelocity and you old angle. It looks like the vehicle model changes.
You also need the codes GetVehicleModelIDFromName and the vehicle name list, which I took from fsdebug, so credits to who made that. You can find those here: http://pastebin.com/17CYGReZ
Have fun with it!