SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/06/2012, 10:03 PM   #1
Swyft™
Gangsta
 
Swyft™'s Avatar
 
Join Date: Jan 2010
Location: Canada
Posts: 533
Reputation: 83
Default /car command again!!!!

ALL FIXED I FIGURED IT OUT!!!!!

THANKS FOR THE POSTS, THIS CAN BE DELETED OR LOCKED!

Last edited by Swyft™; 24/06/2012 at 05:36 AM.
Swyft™ is offline   Reply With Quote
Old 23/06/2012, 10:21 PM   #2
phillip875
Big Clucker
 
Join Date: Jan 2012
Location: United Kingdom
Posts: 160
Reputation: 21
Default Re: /car command again!!!!

Firstly, you would need to make static name so here is an example:

pawn Code:
CMD:car(playerid,params[])
{
    if(DMZone[playerid] == 0)
    {
        new Float:x,Float:y,Float:z,Float:q,string[70];
        static buffalo[12],input[12];
        format(buffalo,sizeof(buffalo),"buffalo");
        if(sscanf(params,"s",input)) return SendClientMessage(playerid,-1,"Usage: /car [name]");
        GetPlayerPos(playerid,x,y,z);
        if(strcmp(buffalo,input,true) == 0)
        {
            CreateVehicle(402, x,y,z,q, 0, 0, 30);
            format(string,sizeof(string),"Car id = 402 - Color = 0 - color2 = 0");
            SendClientMessage(playerid,-1,string);
        }
    }
    return 1;
}
phillip875 is offline   Reply With Quote
Old 23/06/2012, 10:27 PM   #3
FUNExtreme
Gangsta
 
Join Date: Mar 2008
Posts: 899
Reputation: 110
Default Re: /car command again!!!!

Use the search function please! The forum is full of this and it is fairly easy to find
FUNExtreme is offline   Reply With Quote
Old 23/06/2012, 10:51 PM   #4
Swyft™
Gangsta
 
Swyft™'s Avatar
 
Join Date: Jan 2010
Location: Canada
Posts: 533
Reputation: 83
Default Re: /car command again!!!!

Well I am having no luck, mind helping me out
Swyft™ is offline   Reply With Quote
Old 23/06/2012, 10:56 PM   #5
phillip875
Big Clucker
 
Join Date: Jan 2012
Location: United Kingdom
Posts: 160
Reputation: 21
Default Re: /car command again!!!!

Like I showed above, you would need to compare the input using strcmp.

So you would format a option such as buffalo.

pawn Code:
static buffalo[12],input[12];
format(buffalo,sizeof(buffalo),"buffalo");
if(strcmp(buffalo,input,true) == 0)
{
    // action here..
}
phillip875 is offline   Reply With Quote
Old 23/06/2012, 11:08 PM   #6
Swyft™
Gangsta
 
Swyft™'s Avatar
 
Join Date: Jan 2010
Location: Canada
Posts: 533
Reputation: 83
Default Re: /car command again!!!!

I want it to work for all vehicles.. ur making no sense to me dude i dont want to keep making 10 lines for 1 vehicle
Swyft™ is offline   Reply With Quote
Old 24/06/2012, 12:02 AM   #7
Swyft™
Gangsta
 
Swyft™'s Avatar
 
Join Date: Jan 2010
Location: Canada
Posts: 533
Reputation: 83
Default Re: /car command again!!!!

I need someone to help me please!!!!
Swyft™ is offline   Reply With Quote
Old 24/06/2012, 12:16 AM   #8
milanosie
High-roller
 
milanosie's Avatar
 
Join Date: Dec 2011
Location: Amsterdam, Netherlands
Posts: 1,753
Reputation: 377
Default Re: /car command again!!!!

Imma help you tomorrow on one promise:

STOP bumping topics every 2 hours,
milanosie is offline   Reply With Quote
Old 24/06/2012, 02:12 AM   #9
Dubya
Huge Clucker
 
Dubya's Avatar
 
Join Date: Jun 2012
Location: Missouri, USA
Posts: 458
Reputation: 32
Default Re: /car command again!!!!

pawn Code:
static const VehicleName[212][] =
{
    "Landstalker","Bravura","Buffalo","Linerunner","Perennial","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","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 Racer","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","Stuntplane","Tanker","Road Train","Nebula","Majestic",
    "Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV-1000","Cement Truck","Tow Truck","Fortune","Cadrona","FBI Truck",
    "Willard","Forklift","Tractor","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 A","Monster B","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","Andromada","Dodo","RCCam","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:carname(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1) // Edit this out if you like.
    {
        SendClientMessage(playerid, COLOR_YELLOW, "--------------------------------------------------------------------------------------------------------------------------------");
        SendClientMessage(playerid, COLOR_WHITE, "Vehicle Search:");
        new string[128];
        if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "No keyword specified.");
        if(!params[2]) return SendClientMessage(playerid, COLOR_GREY, "Search keyword too short.");
        for(new v; v < sizeof(VehicleName); v++)
        {
            if(strfind(VehicleName[v], params, true) != -1)
            {
                if(isnull(string)) format(string, sizeof(string), "%s (ID: %d)", VehicleName[v], v+400);
                else format(string, sizeof(string), "%s | %s (ID: %d)", string, VehicleName[v], v+400); // Show's the car's ID and Name.
            }
        }
        if(!string[0]) SendClientMessage(playerid, COLOR_GREY, "No results found.");
        else if(string[127]) SendClientMessage(playerid, COLOR_GREY, "Too many results found.");
        else SendClientMessage(playerid, COLOR_WHITE, string);

        SendClientMessage(playerid, COLOR_YELLOW, "--------------------------------------------------------------------------------------------------------------------------------");
    }
    return 1;
}
// Then Your Command:
CMD:car(playerid,params[])
{
    if(DMZone[playerid] == 0)
    {
        new Float:x,Float:y,Float:z,Float:q,string[70];
        static buffalo[12],input[12];
        format(buffalo,sizeof(buffalo),"buffalo");
        if(sscanf(params,"s",input)) return SendClientMessage(playerid,-1,"Usage: /car [name]");
        GetPlayerPos(playerid,x,y,z);
        if(strcmp(buffalo,input,true) == 0)
        {
            CreateVehicle(402, x,y,z,q, 0, 0, 30);
            format(string,sizeof(string),"Car id = 402 - Color = 0 - color2 = 0");
            SendClientMessage(playerid,-1,string);
        }
    }
    return 1;
}
__________________
Dubya is offline   Reply With Quote
Old 24/06/2012, 03:16 AM   #10
Swyft™
Gangsta
 
Swyft™'s Avatar
 
Join Date: Jan 2010
Location: Canada
Posts: 533
Reputation: 83
Default Re: /car command again!!!!

I actually managed to get it to work.. the only issue is, when I spawn /car infernus it spawns an infernus but on some cars like /car elegy it spawns a Windsor... I did delete some vehicles in the list i have.... but they were armed vehicles or planes and etc... And if I add them in then everyone gets access to those vehicles and can dm the shit outa my stunt server
Swyft™ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Command Bugged] Each time i use /respawnallcars it says Unknown Command Rand_Omar Scripting Help 11 30/09/2012 12:35 AM
Executed ZCMD command returns SERVER: Unknown Command SexTourist Scripting Help 12 03/01/2012 04:38 PM
Slap command returns an Unknown Command when player is not connected HydraX Help Archive 16 01/08/2011 05:19 AM
[HELP] A timer on a command(triggered, whatever) + find command Biesmen Help Archive 5 07/10/2010 08:01 PM
SERVER: Unknown Command when using a scripted command and it does execute! Moustafa Help Archive 6 11/06/2010 01:34 PM


All times are GMT. The time now is 08:40 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.