Need to Make it so this command adds cars while in game
#1

k, so i got this command that i'm gonna use to add my Ownable cars, So making editing the files much easier. Ok so basically i got this command i have made now want i want it to do is creat a vechilce when i set the model, So when i set the model it reads the stuff i have put and goes to the x y and z and the rotation and also the colors. So when i do /addcar and select the model one, It creates a car with the stats i have allready put in the file with the command. Here is the command. I can't get it to create a vechile

pawn Код:
iif(strcmp(cmd, "/addcar", true) == 0)
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_DBLUE, "USAGE: /addcar [Carid] [statcode] [amount]");
    SendClientMessage(playerid, COLOR_GRAD4, "|1 Car Location |2 Car Owner |3 Car Color 1 |4 Car Color 2 |5 Car Model |6 Car Price ");
    SendClientMessage(playerid, COLOR_GRAD4, "|7 Car Name |8 Car Level");
    SendClientMessage(playerid, COLOR_GRAD3, "Car Location dosen't need any amount, Put 0");
    return 1;
    }
    new ccid = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_DBLUE, "USAGE: /addcar [Carid] [statcode] [amount]");
    SendClientMessage(playerid, COLOR_GRAD4, "|1 Car Location |2 Car Owner |3 Car Color 1 |4 Car Color 2 |5 Car Model |6 Car Price ");
    SendClientMessage(playerid, COLOR_GRAD4, "|7 Car Name |8 Car Level");
    SendClientMessage(playerid, COLOR_GRAD3, "Car Location dosen't need any amount, Put 0");
    return 1;
    }
    new stat;
    stat = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_DBLUE, "USAGE: /addcar [Carid] [statcode] [amount]");
    SendClientMessage(playerid, COLOR_GRAD4, "|1 Car Location |2 Car Owner |3 Car Color 1 |4 Car Color 2 |5 Car Model |6 Car Price ");
    SendClientMessage(playerid, COLOR_GRAD4, "|7 Car Name |8 Car Level");
    SendClientMessage(playerid, COLOR_GRAD3, "Car Location dosen't need any amount, Put 0");
    return 1;
    }
    new amount;
    amount = strval(tmp);
    if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1337)
    {
    switch (stat)
    {
    case 1:
    {
    new Float: Carx, Float: Cary, Float: Carz, Float:Carr;
    GetPlayerPos(playerid, Carx, Cary, Carz);
    GetPlayerFacingAngle(playerid, Carr);
    CInfo[ccid][cParkx] = Carx;
    CInfo[ccid][cParky] = Cary;
    CInfo[ccid][cParkz] = Carz;
    CInfo[ccid][cParkr] = Carr;
    SendClientMessage(playerid, COLOR_GREEN, "Car Location set");
    OnPropUpdate();
    }
    case 2:
    {
    CInfo[ccid][cOwner] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Owner Set");
    OnPropUpdate();
    }
    case 3:
    {
    CInfo[ccid][cCol1] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Car 1 Set");
    OnPropUpdate();
    }
    case 4:
    {
    CInfo[ccid][cCol2] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Color 2 Set");
    OnPropUpdate();
    }
    case 5:
    {
    CInfo[ccid][cMod] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Model Set");
    OnPropUpdate();
    }
    case 6:
    {
    CInfo[ccid][cValue] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Price Set");
    OnPropUpdate();
    }
    case 7:
    {
    CInfo[ccid][cName] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Name Set");
    OnPropUpdate();
    }
    case 8:
    {
    CInfo[ccid][cLevel] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Level Set");
    OnPropUpdate();
    }
    default:
    {
    SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Stat Code");
    }
    }
    }
//  SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
    return 1;
    }
When i do that, It sets the name For "0" and not what i typed
Reply
#2

Bump, Nothin?
Reply
#3

I don't know how to do this. But if I'm right you can add cars in a map editor and convert them with a convert program/site
Reply
#4

Quote:
Originally Posted by bartje01
I don't know how to do this. But if I'm right you can add cars in a map editor and convert them with a convert program/site
Oh, i don't need to add cars. I just need to creatvehicle so it picks it up as an ownable car and saves it in the file, Also i'm having problems with my Case 11 where i set the name, It sets the name as 0 instead of what i typed
Reply
#5

False.
Reply
#6

no one has anything on this? I've been working on it and i just can't get it but also i am a noob scirpter and i'm learning as i go
Reply
#7

I've modified the command but i still can't get it to creat a vehicle or set a name, it still sets Numbers for names
Reply
#8

Ok, i did a lil modifying of the command but i still can't get it to set a name

pawn Код:
if(strcmp(cmd, "/addcar", true) == 0)
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_DBLUE, "USAGE: /addcar [Carid] [statcode] [amount]");
    SendClientMessage(playerid, COLOR_GRAD4, "|1 Car Location |2 Car Owner |3 Car Color 1 |4 Car Color 2 |5 Car Model |6 Car Price ");
    SendClientMessage(playerid, COLOR_GRAD4, "|7 Car Name |8 Car Level");
    SendClientMessage(playerid, COLOR_GRAD3, "Car Location dosen't need any amount, Put 0");
    return 1;
    }
    new ccid = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_DBLUE, "USAGE: /addcar [Carid] [statcode] [amount]");
    SendClientMessage(playerid, COLOR_GRAD4, "|1 Car Location |2 Car Owner |3 Car Color 1 |4 Car Color 2 |5 Car Model |6 Car Price ");
    SendClientMessage(playerid, COLOR_GRAD4, "|7 Car Name |8 Car Level");
    SendClientMessage(playerid, COLOR_GRAD3, "Car Location dosen't need any amount, Put 0");
    return 1;
    }
    new stat;
    stat = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_DBLUE, "USAGE: /addcar [Carid] [statcode] [amount]");
    SendClientMessage(playerid, COLOR_GRAD4, "|1 Car Location |2 Car Owner |3 Car Color 1 |4 Car Color 2 |5 Car Model |6 Car Price ");
    SendClientMessage(playerid, COLOR_GRAD4, "|7 Car Name |8 Car Level");
    SendClientMessage(playerid, COLOR_GRAD3, "Car Location dosen't need any amount, Put 0");
    return 1;
    }
    new amount;
    amount = strval(tmp);
    tmp = strtok(cmdtext, idx);
    if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1337)
    {
    switch (stat)
    {
    case 1:
    {
    new Float: Carx, Float: Cary, Float: Carz, Float:Carr;
    GetPlayerPos(playerid, Carx, Cary, Carz);
    GetPlayerFacingAngle(playerid, Carr);
    CInfo[ccid][cParkx] = Carx;
    CInfo[ccid][cParky] = Cary;
    CInfo[ccid][cParkz] = Carz;
    CInfo[ccid][cParkr] = Carr;
    SendClientMessage(playerid, COLOR_GREEN, "Car Location set");
    OnPropUpdate();
    }
    case 2:
    {
    CInfo[ccid][cOwner] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Owner Set");
    OnPropUpdate();
    }
    case 3:
    {
    CInfo[ccid][cCol1] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Car 1 Set");
    OnPropUpdate();
    }
    case 4:
    {
    CInfo[ccid][cCol2] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Color 2 Set");
    OnPropUpdate();
    }
    case 5:
    {
    CInfo[ccid][cMod] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Model Set");
    OnPropUpdate();
    }
    case 6:
    {
    CInfo[ccid][cValue] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Price Set");
    OnPropUpdate();
    }
    case 7:
    {
    CInfo[ccid][cName] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Name Set");
    OnPropUpdate();
    }
    case 8:
    {
    CInfo[ccid][cLevel] = amount;
    SendClientMessage(playerid, COLOR_GREEN, "Car Level Set");
    OnPropUpdate();
    }
    default:
    {
    SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Stat Code");
    }
    }
    }
//  SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
    return 1;
    }
I've tried everything i can think of, Basically what i want it to do (case 7) If i type /addcar [carid] 7 Elegy, It just sets the name for a blank space or a number. How can i make it so Case 7 set Letters instead of blank spaces or numbers. I just can't get this, I've tried many things that i know with No luck
Reply
#9

Check your saving function so it's not saving the name with a %d if it does change it to %s because %s is used for letters and %d for numbers
Reply
#10

Quote:
Originally Posted by Fj0rtizFredde
Check your saving function so it's not saving the name with a %d if it does change it to %s because %s is used for letters and %d for numbers
it saves it it just dosen't add letters like i want it to, Also i'm not using string for the modifed command. I made the command a lil diffrent
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)