/v ([vehicleid]) -
kalanerik99 - 22.01.2015
Hello!
How to make that player could use /v [vehicleid/name] or just /v and dialog will show up
I tried something but it doesnt work!
And how to make that player could enter veh name too.
Thanks
Code:
CMD:v(playerid,params[])
{
if(InDM[playerid]) return GameTextForPlayer(playerid, "~w~You cannot spawn vehicles in ~r~DM",2000,5);
if(params[0])
{
new modelid;
if(sscanf(params, "i", modelid))return GameTextForPlayer(playerid, "~w~/v ~n~~r~[vehicleid]",2000,5);
if(modelid < 400 || modelid > 611) return GameTextForPlayer(playerid, "~w~Invalid ~r~VEHICLE ID!",2000,5);
VehicleSpawner(playerid,modelid);
}
else
{
ShowPlayerDialog(playerid, Dialog_Vehicles, DIALOG_STYLE_LIST, "{ffffff}Vehicle categories:", "Airplanes\nHelicopters\nBikes\nConvertibles\nIndustrial\nLowriders\nOff Road\nPublic Service\nSaloons\nSport Vehicles\nStation Wagons\nBoats\nTrailers\nUnique\nRC Vehicles", "Select", "Back" );
}
return 1;
}
Code:
GetVehicleModelIDFromName(vname[])
{
for(new i = 0; i < 211; i++)
{
if ( strfind(VehicleNames[i], vname, true) != -1 )
return i + 400;
}
return -1;
}
Re: /v ([vehicleid]) -
Schneider - 22.01.2015
Not tested though...
pawn Code:
CMD:v(playerid,params[])
{
if(InDM[playerid]) return GameTextForPlayer(playerid, "~w~You cannot spawn vehicles in ~r~DM",2000,5);
if(params[0])
{
new modelid[32];
if(sscanf(params, "s[32]", modelid)) return GameTextForPlayer(playerid, "~w~/v ~n~~r~[vehicleid/name]",2000,5);
if(strval(modelid) >= 400 || strval(modelid) < 612)
{
VehicleSpawner(playerid,modelid);
}
else
{
new model = GetVehicleModelIDFromName(modelid);
if(model >= 400 || model < 612)
{
VehicleSpawner(playerid,model);
}
else
{
GameTextForPlayer(playerid, "~w~Invalid ~r~Name/ID!",2000,5);
}
}
}
else
{
ShowPlayerDialog(playerid, Dialog_Vehicles, DIALOG_STYLE_LIST, "{ffffff}Vehicle categories:", "Airplanes\nHelicopters\nBikes\nConvertibles\nIndustrial\nLowriders\nOff Road\nPublic Service\nSaloons\nSport Vehicles\nStation Wagons\nBoats\nTrailers\nUnique\nRC Vehicles", "Select", "Back" );
}
return 1;
}
Re: /v ([vehicleid]) -
kalanerik99 - 22.01.2015
Code:
new modelid[32];
if(sscanf(params, "s[32]", modelid)) return GameTextForPlayer(playerid, "~w~/v ~n~~r~[vehicleid/name]",2000,5);
if(strval(modelid) >= 400 || strval(modelid) < 612)
{
VehicleSpawner(playerid,modelid);---this line
Code:
error 035: argument type mismatch (argument 2)
Re: /v ([vehicleid]) -
Schneider - 22.01.2015
Sorry, there are some mistakes in the code, currently fixing and testing it.
Re: /v ([vehicleid]) -
kalanerik99 - 22.01.2015
Ok
btw just /v 411 works (not names and dialog)
Re: /v ([vehicleid]) -
Schneider - 22.01.2015
Got it! Tested and works!
pawn Code:
CMD:v(playerid,params[])
{
if(InDM[playerid]) return GameTextForPlayer(playerid, "~w~You cannot spawn vehicles in ~r~DM",2000,5);
new modelid[32];
if(sscanf(params, "s[32]", modelid)) return ShowPlayerDialog(playerid, Dialog_Vehicles, DIALOG_STYLE_LIST, "{ffffff}Vehicle categories:", "Airplanes\nHelicopters\nBikes\nConvertibles\nIndustrial\nLowriders\nOff Road\nPublic Service\nSaloons\nSport Vehicles\nStation Wagons\nBoats\nTrailers\nUnique\nRC Vehicles", "Select", "Back" );
if(400 <= strval(modelid) <= 611)
{
VehicleSpawner(playerid, strval(modelid));
}
else
{
new model = GetVehicleModelIDFromName(modelid);
if(400 <= model <= 611)
{
VehicleSpawner(playerid, model);
}
else
{
GameTextForPlayer(playerid, "~w~Invalid ~r~Name/ID!",2000,5);
}
}
return 1;
}
Re: /v ([vehicleid]) -
kalanerik99 - 22.01.2015
Yea it works thanks
Sorry my reps hehe some people just give me -rep for joke