03.12.2011, 08:33
Put this at the top of your script where your defines are,
Put this where you put the commands of zcmd,
I didn't test it yet, but I hope that I helped
pawn Код:
#define green "{008000}"
#define yellow "{FAF623}"
#define COLOR_RED 0xAA3333AA
pawn Код:
stock GetVehicleModelIDFromName(const vname[])
{
for(new i=0; i < sizeof(VehicleNames); i++)
{
if (strfind(VehicleNames[i], vname, true) != -1) return i + 400;
}
return -1;
}
stock IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
CMD:v(playerid,params[])
{
new vID[32],modelid;
if(sscanf(params,"s[128]dd",vID)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /v <vehiclename/id>");
if(IsNumeric(vID)) modelid = strval(vID);
else modelid = GetVehicleModelIDFromName(vID);
if(modelid < 400 || modelid > 611) return SendClientMessage(playerid,COLOR_RED, "Invalid Vehiclename/ID!");
new Float:pVposX, Float:pVposY, Float:pVposZ, Float:pVposFA;
GetPlayerPos(playerid, pVposX, pVposY, pVposZ);
GetPlayerFacingAngle(playerid, pVposFA);
if(IsPlayerInAnyVehicle(playerid))
{
new VID = GetPlayerVehicleID(playerid);
GetVehicleZAngle(VID, pVposFA);
}
new CVID, pVW, pINT;
pVW = GetPlayerVirtualWorld(playerid);
pINT = GetPlayerInterior(playerid);
CVID = CreateVehicle(modelid, pVposX, pVposY, pVposZ+0.6, pVposFA, 0);
SetVehicleVirtualWorld(CVID, pVW);
LinkVehicleToInterior(CVID, pINT);
PutPlayerInVehicle(playerid,CVID,0);
new string[128];
format(string,sizeof string,"VEHICLE: "yellow"%s (model id: %i) "green"has been spawned!",VehicleNames[modelid-400],modelid);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}