/Createcar help
#1

When the command is typed it says it is unknown.

*I dont get any errors and all other commands work*
pawn Код:
CMD:createcar(playerid, params[])
{
    new Float: pos[4], name[MAX_PLAYER_NAME], model, type, price, plate = random(1000 + 2500), newveh[MAX_PLAYERS], string[30];

    GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
    GetPlayerFacingAngle(playerid, pos[3]);

    if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
    if(sscanf(params, "iii", model, type, price)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /createcar [model] [type] [price]");

    format(name, sizeof(name), "None"); // to avoid array error -- size is MAX_PLAYER_NAME, as is hOwner

    new INI:File = INI_Open(VehiclePath(vCount));

    INI_SetTag(File, "Vehicle Data");

    INI_WriteString(File, "Owner", name);
    vInfo[vCount][Owner] = name;

    INI_WriteInt(File, "Model", model);
    vInfo[vCount][Model] = model;

    INI_WriteInt(File, "Type", type);
    vInfo[vCount][Type] = type;

    INI_WriteFloat(File, "xPos", pos[0]);
    vInfo[vCount][xPos] = pos[0];

    INI_WriteFloat(File, "yPos", pos[1]);
    vInfo[vCount][yPos] = pos[1];

    INI_WriteFloat(File, "zPos", pos[2]);
    vInfo[vCount][zPos] = pos[2];

    INI_WriteFloat(File, "aPos", pos[3]);
    vInfo[vCount][aPos] = pos[3];

    INI_WriteInt(File, "Price", price);
    vInfo[vCount][Price] = price;

    INI_WriteInt(File, "Plate", plate);
    vInfo[vCount][Plate] = plate;

    INI_WriteInt(File, "Fuel", 100);
    vInfo[vCount][Fuel] = 100;

    INI_WriteInt(File, "StoredSlot1", 0);
    vInfo[vCount][StoredSlot1] = 0;

    INI_WriteInt(File, "StoredSlot1Ammo", 0);
    vInfo[vCount][StoredSlot1Ammo] = 0;

    INI_WriteInt(File, "StoredSlot2", 0);
    vInfo[vCount][StoredSlot2] = 0;

    INI_WriteInt(File, "StoredSlot2Ammo", 0);
    vInfo[vCount][StoredSlot2Ammo] = 0;

    INI_Close(File);

    format(string, sizeof(string), "SA %d", vInfo[vCount][Plate]);
    newveh[playerid] = CreateVehicle(model, pos[0], pos[1], pos[2], pos[3], 0, 0, -1);

    SetVehicleNumberPlate(newveh[playerid], string);
    SetVehicleToRespawn(newveh[playerid]);

    vCount ++;

    PutPlayerInVehicle(playerid, newveh[playerid], 0);
    SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have created a vehicle at your position!");

    return true;
}
Reply
#2

If you want your command /v or /car or something to spawn a car with a name and id you must use this in the top of the script

pawn Код:
new VehicleNames[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"},{"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"},{"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"},{"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"}
};
And the command is

this command was for admins in Jak's scripting and changed it for normal players

pawn Код:
CMD:car(playerid, params[])
{
    LoginCheck(playerid);
    LevelCheck(playerid, 0);
   
    new carID[50], car, colour1, colour2, string[128];
    if(sscanf(params, "s[50]I(255)I(255)", carID, colour1, colour2)) return SendClientMessage(playerid, COLOR_RED, "<!> Syntax Error: /car [VehicleID(Name)] [Color1(Optional)] [Color2(Optional)]");
    if(!isnumeric(carID)) car = GetVehicleModelIDFromName(carID);
    else car = strval(carID);
    if(car < 400 || car > 611) return SendClientMessage(playerid, COLOR_RED, "Syntax Error: Invalid Vehicle Model ID or Name!");

    if(colour1==255) colour1=random(256);
    if(colour2==255) colour2=random(256);

    if(User[playerid][pCar] != -1 && !IsPlayerAdmin(playerid))
    EraseVeh(User[playerid][pCar]);
    new VehicleID;
    new Float:X, Float:Y, Float:Z;
    new Float:Angle, int1;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, Angle);
    int1 = GetPlayerInterior(playerid);
    VehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1);
    LinkVehicleToInterior(VehicleID, int1);
    SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(playerid));
    User[playerid][pCar] = VehicleID;
    format(string, sizeof(string), "You have spawned a \"%s\" (Model: %d) with color %d,%d", VehicleNames[car-400], car, colour1, colour2);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    return 1;
}
Reply
#3

SecretBoss, Stop fucking copying code from your stupid scripts and posting it here. Like a tard.
And on-topic: Try to run crashdetect plugin and see if it prints something in your console.
Reply
#4

It doesn't print anything in my console. That's why I'm so confused as to why it isn't working.
Reply
#5

Its working on my console if you want come in my server and test it, I am just trying to help because I know the feeling when noone helps you.
Reply
#6

@SecretBoss, I am using a command that adds the car to a system. So when the server stops and starts the car will still be there. I know everything is scripted correctly. It's just the command isn't procressing
Reply
#7

I am begginer scripter so I am trying to help as more as I can and about my spawn car system when you spawn a second car the first one is auto-destroyed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)