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 
modelcolor1color2factionfamilyvipFloat:xFloat:yFloat:zFloat:astring[512];
    new 
idDBResult:dbResult[2], attemptsbool:found;
    
GetPlayerPos(playeridxyz); GetPlayerFacingAngle(playerida);
    if(
sscanf(params"dddddd"modelcolor1color2factionfamilyvip)) 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 || color1 255) return SCM(playerid"Invalid color ID.");
    if(
color2 || 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: 1 Guest(s)