13.12.2011, 18:32
Hi.
I wanted to create a command on which my car gets tuned. There should be different tuning styles to select by parameter.
This works quite well, BUT the first tuning style is also applied if you just enter the command without parameter.
this is my command
If anybody could tell me what i missed out here.... would be great
thanks in advance
I wanted to create a command on which my car gets tuned. There should be different tuning styles to select by parameter.
This works quite well, BUT the first tuning style is also applied if you just enter the command without parameter.
this is my command
pawn Код:
dcmd_nitro(playerid, params[]) //tuning
{
if(sscanf(params, "s"))
{
SendClientMessage(playerid, 0xFF0000FF, "Usage: /nitro <type>");
}
else if(IsPlayerInAnyVehicle(playerid) == 1)
{
if(!strcmp(params, "gold", true)) //yellow/black,switch rims
{
AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
AddVehicleComponent(GetPlayerVehicleID(playerid),1087);
AddVehicleComponent(GetPlayerVehicleID(playerid),1080);
ChangeVehicleColor(GetPlayerVehicleID(playerid),6,0);
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
}
else if(!strcmp(params, "pink", true)) //pink/blue,offroad wheels
{
AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
AddVehicleComponent(GetPlayerVehicleID(playerid),1087);
AddVehicleComponent(GetPlayerVehicleID(playerid),1025);
ChangeVehicleColor(GetPlayerVehicleID(playerid),126,2);
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
}
else{SendClientMessage(playerid, 0xFF0000FF, "SERVER: Please use a valid tuning style.");}
}
else {SendClientMessage(playerid, 0xFF0000FF, "SERVER: No car no nitro ;-)");}
return 1;
}
thanks in advance