Help with something thats making me mad
#1

Well, I tried the hole f*cking morning to make a /v [carname/modelid] command, and what did I get? NOTHING
I did something like this:
Quote:
enum cars
{
Landstalker = 400 //More cars obiusly...
};

But when I tiped "/v 411" I just getted a Dumper.... Even if I tiped "/v asd" I got a Dumper too...

If someone can tell me just how to do the variables or whatever to make it work..

Thanks in advance
Reply
#2

post your code.
Reply
#3

Quote:
Originally Posted by mansonh
post your code.
nobody can help you without codes
Reply
#4

Sorry

Here it is:
pawn Код:
#include <a_samp>
////////////////////////////////////////////////////////////////////////////////
#define GELTONA 0xFFFF00FF
#define BALTA 0xFFFFFFFF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_ORANGE 0xFF9900AA
////////////////////////////////////////////////////////////////////////////////
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
////////////////////////////////////////////////////////////////////////////////
new SpawnedVehicles[MAX_PLAYERS];
enum cars
{
  Landstalker = 400,Bravura = 401,Buffalo = 402,Linerunner = 403,Pereniel = 404,Sentinel = 405,Dumper = 406,Firetruck = 407,Trashmaster = 408,Stretch = 409,
    Manana = 410,Infernus = 411,Voodoo = 412,Pony = 413,Mule = 414,Cheetah = 415,Ambulance = 416,Leviathan = 417,Moonbeam = 418,Esperanto = 419,Taxi = 420,Washington = 421,
  /*Bobcat,MrWhoopee,BFInjection,Hunter,Premier,Enforcer,Securicar,Banshee,Predator,Bus,Rhino,//I have to finish these.
    Barracks,Hotknife,Previon,Coach,Cabbie,Stallion,Rumpo,RCBandit,Romero,Packer,Monster,
    Admiral,Squalo,Seasparrow,Pizzaboy,Tram,Turismo,Speeder,Reefer,Tropic,Flatbed,Yankee,
    Caddy,Solair,RCVan,Skimmer,PCJ600,Faggio,Freeway,RCBaron,RCRaider,Glendale,Oceanic,
    Sanchez,Sparrow,Patriot,Quad,Coastguard,Dinghy,Hermes,Sabre,Rustler,ZR350,Walton,Regina,Comet,
    BMX,Burrito,Camper,Marquis,Baggage,Dozer,Maverick,newsChopper,Rancher,FBIRancher,Virgo,Greenwood,
    Jetmax,Hotring,Sandking,BlistaCompact,PoliceMaveric,Boxville,Benson,Mesa,RCGoblin,HotringA,
    HotringB,BloodringBanger,Rancher2,SuperGT,Elegant,Journey,Bike,MountainBike,Beagle,Cropdust,
    Stunt,Tanker,RoadTrain,Nebula,Majestic,Buccaneer,Shamal,Hydra,FCR900,NRG500,HPV1000,CementTruck,
    TowTruck,Fortune,Cadrona,FBITruck,Willard,Forklift,Tractor,Combine,Feltzer,Remington,Slamvan,
    Blade,Streak,Vortex,Vincent,Bullet,Clover,Sadler,FiretruckLA,Hustler,Intruder,Primo,
    Cargobob,Tampa,Sunrise,Merit,Utility,Nevada,Yosemite,Windsor,MonsterA,MonsterB,Uranus,Jester,
    Sultan,Stratum,Elegy,Raindance,RCTiger,Flash,Tahoma,Savanna,Bandito,Kart,Mower,
    Duneride,Sweeper,Broadway,Tornado,AT400,DFT30,Huntley,Stafford,BF400,newsvan,Tug,
    Emperor,Wayfarer,Euros,Hotdog,Club,Andromada,Dodo,RCCam,Launch,PoliceLS,
    PoliceSF,PoliceLV,PoliceRanger,Picador,Swat,Alpha,Phoenix,Glendale2,Sadler2,
    Boxville2,FarmPlow*/

};
////////////////////////////////////////////////////////////////////////////////
forward IsVehicleOccupied(vehicleid);
////////////////////////////////////////////////////////////////////////////////
public OnPlayerCommandText(playerid, cmdtext[])
{
////////////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------- //
// DCMDS                                   //
// -------------------------------------------------------------------------- //
////////////////////////////////////////////////////////////////////////////////
  //Car spawn
    dcmd(v,1,cmdtext);
    return 1;
}
////////////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------- //
// COMMANDS                                  //
// -------------------------------------------------------------------------- //
////////////////////////////////////////////////////////////////////////////////
dcmd_v(playerid, params[])
{
    if(!strlen(params)) return
    SendClientMessage(playerid, 0xFF9900AA, "USAGE: /v [carname/modelid]");
    if(SpawnedVehicles[playerid] != 0) DestroyVehicle(SpawnedVehicles[playerid]);
    new Float:X,Float:Y,Float:Z,Float:ROT;
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,ROT);
    SpawnedVehicles[playerid] = CreateVehicle(cars,X,Y,Z,ROT,-1,-1,60);
    PutPlayerInVehicle(playerid,SpawnedVehicles[playerid],0);
    return 1;
}
////////////////////////////////////////////////////////////////////////////////
public IsVehicleOccupied(vehicleid)
{
  for(new i=0;i<MAX_PLAYERS;i++)
  {
   if(IsPlayerInVehicle(i,vehicleid)) return 1;
  }
  return 0;
}
////////////////////////////////////////////////////////////////////////////////
public OnPlayerDisconnect(playerid)
{
    DestroyVehicle(SpawnedVehicles[playerid]);
  SpawnedVehicles[playerid] = 0;
  return 0;
}
////////////////////////////////////////////////////////////////////////////////
Reply
#5

is this line sposed to be

SpawnedVehicles[playerid] = CreateVehicle(cars,X,Y,Z,ROT,-1,-1,60);

cars is getting it from the array

dont you need params[0] ?

im no expert but thats how i would do it
Reply
#6

off topic, your enum is inneficient:

pawn Код:
enum cars
{
  Landstalker = 400,
    Bravura,Buffalo,Linerunner,Pereniel,Sentinel,Dumper,Firetruck,Trashmaster ,Stretch,
    Manana,Infernus,Voodoo,Pony,Mule,Cheetah,Ambulance,Leviathan,Moonbeam,Esperanto,
    Taxi,Washington,Bobcat,MrWhoopee,BFInjection,Hunter,Premier,Enforcer,Securicar,Banshee,
    Predator,Bus,Rhino,
// no you don't have to finish these :) enum is your friend, if you treat it right
    Barracks,Hotknife,Previon,Coach,Cabbie,Stallion,Rumpo,RCBandit,Romero,Packer,Monster,
    Admiral,Squalo,Seasparrow,Pizzaboy,Tram,Turismo,Speeder,Reefer,Tropic,Flatbed,Yankee,
    Caddy,Solair,RCVan,Skimmer,PCJ600,Faggio,Freeway,RCBaron,RCRaider,Glendale,Oceanic,
    Sanchez,Sparrow,Patriot,Quad,Coastguard,Dinghy,Hermes,Sabre,Rustler,ZR350,Walton,Regina,
    Comet,BMX,Burrito,Camper,Marquis,Baggage,Dozer,Maverick,newsChopper,Rancher,
    FBIRancher,Virgo,Greenwood,
    Jetmax,Hotring,Sandking,BlistaCompact,PoliceMaveric,Boxville,Benson,Mesa,RCGoblin,HotringA,
    HotringB,BloodringBanger,Rancher2,SuperGT,Elegant,Journey,Bike,MountainBike,Beagle,Cropdust,
    Stunt,Tanker,RoadTrain,Nebula,Majestic,Buccaneer,Shamal,Hydra,FCR900,NRG500,HPV1000,CementTruck,
    TowTruck,Fortune,Cadrona,FBITruck,Willard,Forklift,Tractor,Combine,Feltzer,Remington,Slamvan,
    Blade,Streak,Vortex,Vincent,Bullet,Clover,Sadler,FiretruckLA,Hustler,Intruder,Primo,
    Cargobob,Tampa,Sunrise,Merit,Utility,Nevada,Yosemite,Windsor,MonsterA,MonsterB,Uranus,Jester,
    Sultan,Stratum,Elegy,Raindance,RCTiger,Flash,Tahoma,Savanna,Bandito,Kart,Mower,
    Duneride,Sweeper,Broadway,Tornado,AT400,DFT30,Huntley,Stafford,BF400,newsvan,Tug,
    Emperor,Wayfarer,Euros,Hotdog,Club,Andromada,Dodo,RCCam,Launch,PoliceLS,
    PoliceSF,PoliceLV,PoliceRanger,Picador,Swat,Alpha,Phoenix,Glendale2,Sadler2,
    Boxville2,FarmPlow
};
Reply
#7

Quote:
Originally Posted by mansonh
off topic, your enum is inneficient:

pawn Код:
enum cars
{
  Landstalker = 400,
    Bravura,Buffalo,Linerunner,Pereniel,Sentinel,Dumper,Firetruck,Trashmaster ,Stretch,
    Manana,Infernus,Voodoo,Pony,Mule,Cheetah,Ambulance,Leviathan,Moonbeam,Esperanto,
    Taxi,Washington,Bobcat,MrWhoopee,BFInjection,Hunter,Premier,Enforcer,Securicar,Banshee,
    Predator,Bus,Rhino,
// no you don't have to finish these :) enum is your friend, if you treat it right
    Barracks,Hotknife,Previon,Coach,Cabbie,Stallion,Rumpo,RCBandit,Romero,Packer,Monster,
    Admiral,Squalo,Seasparrow,Pizzaboy,Tram,Turismo,Speeder,Reefer,Tropic,Flatbed,Yankee,
    Caddy,Solair,RCVan,Skimmer,PCJ600,Faggio,Freeway,RCBaron,RCRaider,Glendale,Oceanic,
    Sanchez,Sparrow,Patriot,Quad,Coastguard,Dinghy,Hermes,Sabre,Rustler,ZR350,Walton,Regina,
    Comet,BMX,Burrito,Camper,Marquis,Baggage,Dozer,Maverick,newsChopper,Rancher,
    FBIRancher,Virgo,Greenwood,
    Jetmax,Hotring,Sandking,BlistaCompact,PoliceMaveric,Boxville,Benson,Mesa,RCGoblin,HotringA,
    HotringB,BloodringBanger,Rancher2,SuperGT,Elegant,Journey,Bike,MountainBike,Beagle,Cropdust,
    Stunt,Tanker,RoadTrain,Nebula,Majestic,Buccaneer,Shamal,Hydra,FCR900,NRG500,HPV1000,CementTruck,
    TowTruck,Fortune,Cadrona,FBITruck,Willard,Forklift,Tractor,Combine,Feltzer,Remington,Slamvan,
    Blade,Streak,Vortex,Vincent,Bullet,Clover,Sadler,FiretruckLA,Hustler,Intruder,Primo,
    Cargobob,Tampa,Sunrise,Merit,Utility,Nevada,Yosemite,Windsor,MonsterA,MonsterB,Uranus,Jester,
    Sultan,Stratum,Elegy,Raindance,RCTiger,Flash,Tahoma,Savanna,Bandito,Kart,Mower,
    Duneride,Sweeper,Broadway,Tornado,AT400,DFT30,Huntley,Stafford,BF400,newsvan,Tug,
    Emperor,Wayfarer,Euros,Hotdog,Club,Andromada,Dodo,RCCam,Launch,PoliceLS,
    PoliceSF,PoliceLV,PoliceRanger,Picador,Swat,Alpha,Phoenix,Glendale2,Sadler2,
    Boxville2,FarmPlow
};
Its just that I dont have all the 211 models ids, I took trailers and trains.

Any fix?
Reply
#8

oh ok.
Well then wherever you have taken one out, put the next vehicle number in right after
I put one example in for you:

(however it would be better to leave them all in, and then in your script exclude those)


pawn Код:
enum cars
{
  Landstalker = 400,
    Bravura,Buffalo,Linerunner,Pereniel,Sentinel,Dumper,Firetruck,Trashmaster ,Stretch,
    Manana,Infernus,Voodoo,Pony,Mule,Cheetah,Ambulance,Leviathan,Moonbeam,Esperanto,
    Taxi,Washington,Bobcat,MrWhoopee,BFInjection,Hunter,Premier,Enforcer,Securicar,Banshee,
    Predator,Bus,Rhino,
// no you don't have to finish these :) enum is your friend, if you treat it right
    Barracks,Hotknife,
Previon=436,
    Coach,Cabbie,Stallion,Rumpo,RCBandit,Romero,Packer,Monster,
    Admiral,Squalo,Seasparrow,Pizzaboy,Tram,Turismo,Speeder,Reefer,Tropic,Flatbed,Yankee,
    Caddy,Solair,RCVan,Skimmer,PCJ600,Faggio,Freeway,RCBaron,RCRaider,Glendale,Oceanic,
    Sanchez,Sparrow,Patriot,Quad,Coastguard,Dinghy,Hermes,Sabre,Rustler,ZR350,Walton,Regina,
    Comet,BMX,Burrito,Camper,Marquis,Baggage,Dozer,Maverick,newsChopper,Rancher,
    FBIRancher,Virgo,Greenwood,
    Jetmax,Hotring,Sandking,BlistaCompact,PoliceMaveric,Boxville,Benson,Mesa,RCGoblin,HotringA,
    HotringB,BloodringBanger,Rancher2,SuperGT,Elegant,Journey,Bike,MountainBike,Beagle,Cropdust,
    Stunt,Tanker,RoadTrain,Nebula,Majestic,Buccaneer,Shamal,Hydra,FCR900,NRG500,HPV1000,CementTruck,
    TowTruck,Fortune,Cadrona,FBITruck,Willard,Forklift,Tractor,Combine,Feltzer,Remington,Slamvan,
    Blade,Streak,Vortex,Vincent,Bullet,Clover,Sadler,FiretruckLA,Hustler,Intruder,Primo,
    Cargobob,Tampa,Sunrise,Merit,Utility,Nevada,Yosemite,Windsor,MonsterA,MonsterB,Uranus,Jester,
    Sultan,Stratum,Elegy,Raindance,RCTiger,Flash,Tahoma,Savanna,Bandito,Kart,Mower,
    Duneride,Sweeper,Broadway,Tornado,AT400,DFT30,Huntley,Stafford,BF400,newsvan,Tug,
    Emperor,Wayfarer,Euros,Hotdog,Club,Andromada,Dodo,RCCam,Launch,PoliceLS,
    PoliceSF,PoliceLV,PoliceRanger,Picador,Swat,Alpha,Phoenix,Glendale2,Sadler2,
    Boxville2,FarmPlow
};
Reply
#9

I understood

That will fix my problem?

I think I will have to try ...

EDIT: Still not working...

Any fix?
Reply
#10

No that wasn't anything to do with the problem.
However your problem is easy:

SpawnedVehicles[playerid] = CreateVehicle(cars,X,Y,Z,ROT,-1,-1,60);

cars is the enum list not what the user typed.

You need to check what the user typed in and use that.

So yah just have an array of vehicle names, I don't think there is any way to get strings to enums.

ex:
new vehicles[212][] = {"Landstalker", ....}

Wait you just released a script like this:
http://forum.sa-mp.com/index.php?topic=150905.0

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)