[Plugin] Life Command Engine [LIFE:CMD]
#21

Commands with params won't work. Below is example of command (rather - script), which not work:
pawn Код:
#include <a_samp>
#include <LIFE-CMD>

new gVehicleNames[212][] =
{
    "Landstalker", "Bravura", "Buffalo", "Linerunner", "Pereniel", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana",
    "Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi", "Washington", "Bobcat",
    "Mr Whoopee", "BF Injection", "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks",
    "Hotknife", "Trailer", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral",
    "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy",
    "Solair", "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Harley", "RC Baron", "RC Raider", "Glendale", "Oceanic",
    "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR3 50", "Walton", "Regina",
    "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher", "FBI Rancher",
    "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa",
    "RC Goblin", "Hotring Racer", "Hotring Racer", "Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey", "Bike",
    "Mountain Bike", "Beagle", "Cropdust", "Stunt", "Tanker", "RoadTrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra",
    "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune", "Cadrona", "FBI Truck", "Willard", "Forklift", "Traktor",
    "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover", "Sadler",
    "Firetruck", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor",
    "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna",
    "Bandito", "Freight", "Trailer", "Kart", "Mower", "Duneride", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley",
    "Stafford", "BF-400", "Newsvan", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club", "Trailer", "Trailer",
    "Andromeda", "Dodo", "RC Cam", "Launch", "Radiowoz", "Radiowoz", "Radiowoz", "Radiowoz", "Picador", "S.W.A.T. Van",
    "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer", "Luggage Trailer", "Stair Trailer", "Boxville", "Farm Plow", "Utility Trailer"
};

playaName(playerid)
{
    static Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    return Name;
}

CreatePlayerVehicle(playerid, modelid)
{
    new vehicle, Float: X, Float: Y, Float: Z, Float: angle;
    if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        vehicle = GetPlayerVehicleID(playerid);
        GetVehiclePos(vehicle, X, Y, Z);
        GetVehicleZAngle(vehicle, angle);
        DestroyVehicle(vehicle);
    }
    else
    {
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, angle);
    }
    vehicle = AddStaticVehicle(modelid, X, Y, Z + 1, angle, -1, -1);
    LinkVehicleToInterior(vehicle, GetPlayerInterior(playerid));
    SetVehicleVirtualWorld(vehicle, GetPlayerVirtualWorld(playerid));
    SetVehicleNumberPlate(vehicle, playaName(playerid));
    PutPlayerInVehicle(playerid, vehicle, 0);
    return 1;
}

str_del_free_space (string[], _char = ' ')
{
    new len = strlen (string);
    if (len)
    {
        new begin = -1, end = len;
        while (string[++begin] == _char) {}
        if (string[begin] == EOS)
        {
             string [0] = 0;
             return 1;
        }
        while (string[--end] == _char) {}
        strmid (string, string, begin, end+1, len+1);
    }
    return 1;
}

GetVehicleModelIdByName(vehiclename[])
{
    for(new i = 0; i < 211; i++)
        if (strfind(gVehicleNames[i], vehiclename, true) != -1) return i + 400;
    return -1;
}

CMD:v(playerid, params[])
{
    str_del_free_space(params);
    if(isnull(params)) return SendClientMessage(playerid, -1, "Write /v CarName");
    CreatePlayerVehicle(playerid, GetVehicleModelIdByName(params));
    return 1;
}
Reply


Messages In This Thread
Life Command Engine [LIFE:CMD] - by Kazon - 19.03.2013, 14:41
Re: Life Command Engine [LIFE:CMD] - by Niko_boy - 19.03.2013, 14:58
Re: Life Command Engine [LIFE:CMD] - by sKgaL - 19.03.2013, 15:02
Re: Life Command Engine [LIFE:CMD] - by Kazon - 19.03.2013, 15:03
Re: Life Command Engine [LIFE:CMD] - by Kazon - 19.03.2013, 15:05
Re: Life Command Engine [LIFE:CMD] - by Bikken - 19.03.2013, 15:35
Re: Life Command Engine [LIFE:CMD] - by Kazon - 19.03.2013, 15:43
Re: Life Command Engine [LIFE:CMD] - by xeeZ - 19.03.2013, 18:55
Re: Life Command Engine [LIFE:CMD] - by thefatshizms - 19.03.2013, 19:25
Re: Life Command Engine [LIFE:CMD] - by Dystans - 19.03.2013, 19:42
Re: Life Command Engine [LIFE:CMD] - by steki. - 19.03.2013, 19:58
Re: Life Command Engine [LIFE:CMD] - by greentarch - 19.03.2013, 22:20
Re: Life Command Engine [LIFE:CMD] - by Yves - 19.03.2013, 22:49
Re: Life Command Engine [LIFE:CMD] - by Skyrise - 19.03.2013, 23:56
Re: Life Command Engine [LIFE:CMD] - by RebeloX - 20.03.2013, 00:06
Re: Life Command Engine [LIFE:CMD] - by MP_Spec - 20.03.2013, 00:14
Re: Life Command Engine [LIFE:CMD] - by OKStyle - 20.03.2013, 04:49
Re: Life Command Engine [LIFE:CMD] - by Kazon - 20.03.2013, 06:50
Re: Life Command Engine [LIFE:CMD] - by Kazon - 20.03.2013, 08:52
Re: Life Command Engine [LIFE:CMD] - by Kazon - 20.03.2013, 09:15
Re: Life Command Engine [LIFE:CMD] - by Dystans - 21.03.2013, 19:34
Re: Life Command Engine [LIFE:CMD] - by MP_Spec - 24.03.2013, 21:01
Re: Life Command Engine [LIFE:CMD] - by Ballu Miaa - 28.03.2013, 16:30
Re: Life Command Engine [LIFE:CMD] - by RebeloX - 28.03.2013, 18:06
Re: Life Command Engine [LIFE:CMD] - by RebeloX - 28.03.2013, 18:42
Re: Life Command Engine [LIFE:CMD] - by RebeloX - 28.03.2013, 18:57
Re: Life Command Engine [LIFE:CMD] - by AndreT - 28.03.2013, 21:12
Re: Life Command Engine [LIFE:CMD] - by zSuYaNw - 29.03.2013, 03:33
Re: Life Command Engine [LIFE:CMD] - by Ballu Miaa - 29.03.2013, 04:51
Re: Life Command Engine [LIFE:CMD] - by fightaxe - 27.06.2013, 14:06
Re: Life Command Engine [LIFE:CMD] - by spell - 16.04.2015, 00:32

Forum Jump:


Users browsing this thread: 1 Guest(s)