14.01.2012, 16:36
Hello, I have 4 vehicle slots, and I want this command to choose from 1-4 depending on if the vehicle slot is empty or not. In other words, I want it to pick the first vehicle slot thats not empty, and I want it to be as short as possible.
This is my command, for now it only picks the vehicle from slot one.
I've been away from this for a long time, and I just started using YCMD, so if theres any major errors, let me know.
This is my command, for now it only picks the vehicle from slot one.
pawn Код:
YCMD:car(playerid, params[],help)
{
if(help)
{
SendClientMessage(playerid, 0xFF0000AA, "nope");
}
else
{
#pragma unused params
if(SpawnedVehicles[playerid] != 0) DestroyVehicle(SpawnedVehicles[playerid]);
new
Float:X, Float:Y, Float:Z,
Float:Angle,int1,
vehicle = PlayerInfo[playerid][pVehicle1];
GetPlayerFacingAngle(playerid,Angle);
GetPlayerPos(playerid, X,Y,Z);
int1 = GetPlayerInterior(playerid);
SpawnedVehicles[playerid] = CreateVehicle(vehicle, X,Y,Z, Angle, -1, -1, -1);
LinkVehicleToInterior(vehicle,int1);
PutPlayerInVehicle(playerid,SpawnedVehicles[playerid],0);
}
return 1;
}