Using ReturnVehicleModelID(id);
#1

Well , Basically - I was wondering how to add that function to my command.

Instead of using ID's - I'd like to use names too.

Here is the CMD :

PHP код:
    if(PlayerInfo[playerid][pAdmin] < 1337) return SCM(playerid, "You cannot use this command.");
    new 
model, color1, color2, faction, family, vip, Float:x, Float:y, Float:z, Float:a, string[512];
    new 
id, DBResult:dbResult[2], attempts, bool:found;
    
GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a);
    if(
sscanf(params, "dddddd", model, color1, color2, faction, family, vip)) return SyntaxMessage(playerid, "/permcar [model] [color 1] [color 2] [faction] [family] [VIP]");
    if(
model < 400 || model > 611) return SCM(playerid, "Invalid model ID/Name.");
    if(
color1 < 0 || color1 > 255) return SCM(playerid, "Invalid color ID.");
    if(
color2 < 0 || color2 > 255) return SCM(playerid, "Invalid color ID."); 
Notice : That's not the full CMD - But it's the needed part.
Thank you.
Reply
#2

Take a look at ReturnVehicleModelID code. It takes in a string, and returns id. So:
pawn Код:
//find
new model, color1, color2, faction, family, vip, Float:x, Float:y, Float:z, Float:a, string[512];
//change to
new model, color1, color2, faction, family, vip, Float:x, Float:y, Float:z, Float:a, string[512], modelstr[64+1];

//find
if(sscanf(params, "dddddd", model, color1, color2, faction, family, vip)) return SyntaxMessage(playerid, "/permcar [model] [color 1] [color 2] [faction] [family] [VIP]");
//change to
if(sscanf(params, "s[64]ddddd", modelstr, color1, color2, faction, family, vip)) return SyntaxMessage(playerid, "/permcar [model] [color 1] [color 2] [faction] [family] [VIP]");
model = ReturnVehicleModelID(modelstr);
Reply


Forum Jump:


Users browsing this thread: