if (strcmp(cmd, "/v", true)==0)
{
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
// == means DEFAULTS so you are not force to enter those values
SendClientMessage(playerid, 0xFFFF00AA, "USE: /v [modelid] [delay==-1] [color1==random] [color2==random]");
return 1;
}
new mid = strval(tmp);
if ((mid<400)||(mid>611))
{
SendClientMessage(playerid, 0xAA3333AA, "WARNING! WRONG MODEL ID");
return 1;
}
new delay;
if (!strlen(tmp))
{
delay = -1;
}
else{
delay = strval(tmp);
}
new color1;
if (!strlen(tmp))
{
color1 = random(50);
}
else{
color1 = strval(tmp);
}
new color2;
if (!strlen(tmp))
{
color2 = random(50);
}
else{
color2 = strval(tmp);
}
new Float:pX, Float:pY, Float:pZ, Float:pAng;
GetPlayerPos(playerid,pX,pY,pZ);
GetPlayerFacingAngle(playerid,pAng);
new CurrentVehicle = CreateVehicle(mid,pX+3.0*floatsin(-pAng,degrees),pY+3.0*floatcos(-pAng,degrees),pZ+0.5,pAng+90.0, color1, color2, delay); format(tmp, sizeof(tmp), "New vehicle id is: %d and its model is: %d",CurrentVehicle,mid);
SendClientMessage(playerid, COLOR_BLUE, tmp);
return 1;
}