About vehicles
#10

Put this at the top of your script where your defines are,

pawn Код:
#define green "{008000}"
#define yellow "{FAF623}"
#define COLOR_RED 0xAA3333AA
Put this where you put the commands of zcmd,

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;
}
I didn't test it yet, but I hope that I helped
Reply


Messages In This Thread
About vehicles - by GAMER_PS2 - 30.11.2011, 02:49
Re: About vehicles - by =WoR=Varth - 30.11.2011, 03:12
Re: About vehicles - by GAMER_PS2 - 30.11.2011, 03:39
Re: About vehicles - by JamesC - 30.11.2011, 04:05
Re: About vehicles - by GAMER_PS2 - 30.11.2011, 05:47
Re: About vehicles - by leong124 - 30.11.2011, 05:53
Re: About vehicles - by GAMER_PS2 - 30.11.2011, 06:01
Re: About vehicles - by GAMER_PS2 - 30.11.2011, 06:13
Re: About vehicles - by GAMER_PS2 - 30.11.2011, 10:13
Re: About vehicles - by PlayHard - 03.12.2011, 08:33

Forum Jump:


Users browsing this thread: 3 Guest(s)