29.08.2013, 04:27
Hello, I'm trying to make a dynamic vehicle system and atm making a command to create a sales vehicle.
But I'm having trubble on finding out how I can let the server know what price to put for the created vehicle?
I want the cmd to be like this " /salesveh [model id] [color 1] [color 2] [price] " but how can i add the price in the AddStaticVehicleEx? Or do I add it somewhere else in the command? Here is what I got so far..
But I'm having trubble on finding out how I can let the server know what price to put for the created vehicle?
I want the cmd to be like this " /salesveh [model id] [color 1] [color 2] [price] " but how can i add the price in the AddStaticVehicleEx? Or do I add it somewhere else in the command? Here is what I got so far..
pawn Код:
if(strcmp(cmd, "/salesveh", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /createsalescar [carid] [color1] [color2] [price]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, " Vehicle Number can't be below 400 or above 611 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /createsalescar [carid] [color1] [color2] [price]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < -1 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /createsalescar [carid] [color1] [color2] [price]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < -1 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /createsalescar [carid] [color1] [color2] [price]");
return 1;
}
new price = strval(tmp);
if(price < 1 || > 9999999) { SendClientMessage(playerid, COLOR_GREY, "Price Can't be below 1 or above 9999999 !"); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new Float:Angle;
GetPlayerFacingAngle(playerid, Angle);
new carid = AddStaticVehicleEx(car, X,Y,Z, Angle, color1, color2, -1);