#1

I've modified my new VehicleNames
i remove 3 vehicles (2 trains 1 tram)

However, when i do NRG-500 it doesn't spawn me NRG-500 instead it spawn me
FCR-900 vehicle

code

pawn Код:
new VehicleName[209][] = {
    {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"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 1"},{"Previon"},
    {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
    {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Trailer 2"},{"Turismo"},
    {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
    {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
    {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
    {"Rustler"},{"ZR-350"},{"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 A"},{"Hotring Racer B"},{"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"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
    {"Blade"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
    {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
    {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
    {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
    {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
    {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
    {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
    {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
    {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
    {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
    {"Utility Trailer"}
};

CMD:car(playerid, params[])
{
    new string[128], vID[32], vVW, vINT, vid, Float:x, Float:y, Float:z, Float:ang, vehicle;
    if(GetPlayerState(playerid) != 1 && GetPlayerState(playerid) != 2 && GetPlayerState(playerid) != 3)
    return SendClientMessage(playerid, COLOR_RED, "[Spawned]: You're not able to use this command!, Spawn first!");
    if(InDM[playerid] >= 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot use this command right now, At DM!");
    if(pInfo[playerid][Jail] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot use this command while in jail!");
    if(pInfo[playerid][Freeze] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You are frozen, Cannot use the command!");
    if(RaceParticipant[playerid] > 0) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot use this command while in the race!");
    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot spawn vehicle inside the vehicle passenger sit!");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "[Error]: You already have vehicle!");
    if(sscanf(params, "s[32]", vID)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /car or /v <vehiclename or vehicleid>");
    if(isnumeric(vID)) vid = strval(vID);
    else vid = GetVehicleModelIDFromName(vID);
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, ang);
    if(vid < 400 || vid > 608) return SendClientMessage(playerid, COLOR_RED, "[Error]: Invalid VehicleID (400 - 611 only!!)");
    vehicle = CreateVehicle(vid, x, y, z, ang, -1, -1, 0);
    vVW = GetPlayerVirtualWorld(playerid);
    vINT = GetPlayerInterior(playerid);
    SetVehicleVirtualWorld(vehicle, vVW);
    LinkVehicleToInterior(vehicle, vINT);
    SetVehicleNumberPlate(vehicle, ""red"S4L "yellow"v1");
    PutPlayerInVehicle(playerid, vehicle, 0);
    format(string, sizeof(string), "[Vehicle]: Vehicle %s(%i) spawned!", VehicleName[vid - 400], vid);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    return 1;
}

stock GetVehicleModelIDFromName(const vname[])
{
    for(new i=0; i < sizeof(VehicleName); i++)
    {
        if (strfind(VehicleName[i], vname, true) != -1) return i + 400;
    }
    return -1;
}
Reply
#2

Okay, for example:
You have 400 models, there is numbers:

123, 124, 125, 126, 127, 128, 129, 130

You have removed three of them, in this case, you have removed 124, 128 and 129, so you are left with 123, 125, 126, 127, 130. These then become: 123, 124, 125 and 126. This is what you have done here, so you will need to, instead of completely removing the vehicle names, just replace them with " ". Otherwise it will stuff up the count.

EDIT: You could also, instead of completely removing the vehicle names from the list or replacing them with " ", you could adjust your stock function to ignore them.

pawn Код:
stock GetVehicleModelIDFromName(const vname[])
{
    for(new i=0; i < sizeof(VehicleName); i++)
    {
        if (strfind(VehicleName[i], vname, true) != -1)
        {
            new vehid = i + 400;
            if(vehid == train1id || vehid == train2id || vehid == tramid) return -1; //Obviously replace train1id, train2id and tramid with the appropriate Vehicle models.
            return vehid;
        }
    }
    return -1;
}
Reply
#3

Because you replaced the modelids after the trains and tram and they got lower IDs.
Just use the 212 vehicles and check on the command, if the modelid is one of the train or tram, return true to prevent it from spawning it.
Reply
#4

I try yourcode BenzoAMG didn't work.
Reply
#5

I already gave you a solution that you probably didn't even try it.

For one more time, use it as it was, with 212 the array and on your command.
pawn Код:
if(isnumeric(vID)) vid = strval(vID);
else vid = GetVehicleModelIDFromName(vID);

if( vid == /* tram's modelid */ || vid == /* train1's modelid */ || vid == /* train2's modelid */ || ) return 1;
Reply
#6

it still doesn't work.
Code.

pawn Код:
CMD:car(playerid, params[])
{
    new string[128], vID[32], vVW, vINT, vid, Float:x, Float:y, Float:z, Float:ang, vehicle;
    if(GetPlayerState(playerid) != 1 && GetPlayerState(playerid) != 2 && GetPlayerState(playerid) != 3)
    return SendClientMessage(playerid, COLOR_RED, "[Spawned]: You're not able to use this command!, Spawn first!");
    if(InDM[playerid] >= 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot use this command right now, At DM!");
    if(pInfo[playerid][Jail] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot use this command while in jail!");
    if(pInfo[playerid][Freeze] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You are frozen, Cannot use the command!");
    if(RaceParticipant[playerid] > 0) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot use this command while in the race!");
    if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED, "[Error]: You cannot spawn vehicle inside the vehicle passenger sit!");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "[Error]: You already have vehicle!");
    if(sscanf(params, "s[32]", vID)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /car or /v <vehiclename or vehicleid>");
    if(isnumeric(vID)) vid = strval(vID);
    else vid = GetVehicleModelIDFromName(vID);
    if(vid == 538 || vid == 537 || vid == 449) return SendClientMessage(playerid, COLOR_RED, "[Error]: Cannot spawn that kind of vehicle!");
    if(vid < 400 || vid > 608) return SendClientMessage(playerid, COLOR_RED, "[Error]: Invalid VehicleID (400 - 611 only!!)");
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, ang);
    vehicle = CreateVehicle(vid, x, y, z, ang, -1, -1, 0);
    vVW = GetPlayerVirtualWorld(playerid);
    vINT = GetPlayerInterior(playerid);
    SetVehicleVirtualWorld(vehicle, vVW);
    LinkVehicleToInterior(vehicle, vINT);
    SetVehicleNumberPlate(vehicle, ""red"S4L "yellow"v1");
    PutPlayerInVehicle(playerid, vehicle, 0);
    format(string, sizeof(string), "[Vehicle]: Vehicle %s(%i) spawned!", VehicleName[vid - 400], vid);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    return 1;
}
Reply
#7

when i type sultan or nrg.

It spawn me FCR (when i type nrg)
It spawn me Monster Truck (When i type sultan)

But if i type something else like Infernus. It spawn me Infernus.
Reply
#8

please post your command code
Reply
#9

As Dark said,please post your command code so we can see whats the problem,or theres a problem with the Vehicle Spawn.


EDIT:Your Vehicle Ids are messed up thats why they spawn FCR,BTW replace the FCR vehicle ID to 522(NRG-500)
Reply
#10

Quote:
Originally Posted by JerryBean
Посмотреть сообщение
As Dark said,please post your command code so we can see whats the problem,or theres a problem with the Vehicle Spawn.


EDIT:Your Vehicle Ids are messed up thats why they spawn FCR,BTW replace the FCR vehicle ID to 522(NRG-500)
What the fuck?
Replace vehicle id?
But the new VehicleName shows up the vehicle name not vehicle id.
So how could i replace it?. I cannot replace the game vehicle ids from the game file lol.

Better read the code next time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)