05.02.2010, 05:19
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
When i do that, It sets the name For "0" and not what i typed
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;
}