25.08.2010, 14:10
I Have this script, i need it to create a car, but i can't fix it.. i'm not good...
pawn Код:
if(strcmp(cmd, "/createcar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] < 4)
{
SendClientMessage(playerid, COLOR_GRAD1, "* Non sei autorizzato ad usare questo comando!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /createcar [carid] [prezzo] [color1] [color2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, "* Il modello non deve essere < 400 o > 611 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /createcar [carid] [prezzo] [color1] [color2]");
return 1;
}
new prezzo;
prezzo = strval(tmp);
if(prezzo < 0 || prezzo > 1000000) { SendClientMessage(playerid, COLOR_GREY, " Prezzo < 0 o > 1.000.000$!"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /createcar [carid] [prezzo] [color1] [color2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 10000) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 10000 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /createcar [carid] [prezzo] [color1] [color2]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 10000) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 10000 !"); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 60000);
format(string, sizeof(string), "** Veicolo numero %d creato! **", carid);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
CarInfo[carid][cModel] = car;
CarInfo[carid][cColorOne] = color1;
CarInfo[carid][cColorTwo] = color2;
CarInfo[carid][cValue] = prezzo;
CarInfo[carid][cLocationx] = X;
CarInfo[carid][cLocationy] = Y;
CarInfo[carid][cLocationz] = Z;
CarInfo[carid][cOwned] = 0;
strmid(CarInfo[carid][cOwner], "Dealership", 0, strlen("Dealership"), 999);
strmid(CarInfo[carid][cTarga], "[STOCK]", 0, strlen("[STOCK]"), 999);
format(gstring, sizeof(gstring), "%s", VehicleNames[GetVehicleModel(carid)-400]);
strmid(CarInfo[carid][cDescription],gstring, 0, strlen(gstring), 999);
OnPropUpdate();
new rd = random(20000)+7500;
SBizzInfo[12][sbTill] -= CarInfo[carid][cValue];
SBizzInfo[12][sbTill] += rd;
}
return 1;
}