player spawn only 1 vehcle
#1

Well Title says it all.

only a /v [car name] command that spawns 1 car only like if player had a vehicle (it doesn't matter if he was in that time a driver or not in the car) it is working by id like the player cars id is 3 when he spawn another car the old car with id 3 is destroyed and the car he wanted to spawn spawns with id 3.

i hope someone help me.
Reply
#2

will any1 help with this i really need it
Reply
#3

So what you want is a vehicle spawning command, and once they spawn another vehicle the previous one is destroyed?
Reply
#4

Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
So what you want is a vehicle spawning command, and once they spawn another vehicle the previous one is destroyed?
yes that is all i want
Reply
#5

I need this too, could i get some help
Reply
#6

pawn Код:
//TOP:
new vehicle[MAX_PLAYERS];
//Commandtext:
new cmd[256], tmp[256];
cmd = strtok(cmdtext, idx);
if(!strcmp(/v, cmdtext)) {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) SendClientMessage(playerid, 0xFF0000FF, "Use: /v [model]");
    if(GetVehicleModel(vehicle[playerid])) DestroyVehicle(vehicle[playerid]);
    vehicle[playerid] = CreateVehicle(strval(tmp), X, Y, Z, angle.....//edit this
}
Reply
#7

Cause I want to create a nrg cmd, so it would be /nrg. And when a person gets off the nrg and use /nrg again it would remove the previous spawned one and spawn a new one with player in it.
Reply
#8

new prevVeh[MAX_PLAYERS]={-1,...};

// in nrg command

if( prevVeh[playerid] != -1 ) DestroyVehicle(prevVeh[playerid]);
prevVeh[playerid] = CreateVehicle( args etc );

// onplayerconnect

prevVeh[playerid] = -1;
Reply
#9

could u make me a example cmd so it goes like this. A player types /nrg and it puts him into the vehicle, so he wants to go out of the vehicle and spawn another. So he does type /nrg again and the previous disappears wherever it was. And make a ex cmd so i can use that for other vehicle cmds please
Reply
#10

Enjoy, if you have any problems, let me know.

Note: You must have ZCMD, if not, just change the command format.

pawn Код:
static aVehicleNames[212][] = {
    {"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"},
    {"Tram"},{"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"},{"Cropduster"},{"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"},
    {"Freight"},{"Streak"},{"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"},{"LS Police Car"},
    {"SF Police Car"},{"LV Police Car"},{"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"}
};
new veh[MAX_PLAYERS];


CMD:v(playerid, params[])
{
    new modelid[50], color1, color2, Float:x, Float:y, Float:z, vehicle;
    if(sscanf(params, "s[50]dd", modelid, color1, color2)) return SendClientMessage(playerid, white, "USAGE: /v [vehiclename] [color1] [color2]");
    new veh = GetVehicleModelID(modelid);
    if(veh < 400 || veh > 611) return SendClientMessage(playerid, COLOR_RED, "Invalid vehicle name specified.");
    if(IsPlayerInAnyVehicle(playerid)) { SetVehicleToRespawn(GetPlayerVehicleID(playerid)); }
    //
    GetPlayerPos(playerid, x, y, z);
    GetXYInFrontOfPlayer(playerid, x, y, 1.5);
    vehicle = CreateVehicle(veh, x, y, z + 0.7, 0, color1, color2, 600);
    PutPlayerInVehicle(playerid, vehicle, 0);
    DestroyVehicle(veh[playerid]);
    veh[playerid] = GetPlayerVehicleID(playerid);
    //
    new string[50]=0;
    format(string, sizeof(string), "You have spawned a {FF0000}%s.", aVehicleNames[veh-400]); SendClientMessage(playerid, white, string);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)