Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help (
/showthread.php?tid=568102)
Help -
iFiras - 19.03.2015
I'm not sure what's wrong with my command but it always returns "SERVER: Unknown command.".
pawn Код:
CMD:veh(playerid, params[])
{
new id, string[128], Float:x, Float:y, Float:z, Float:Angle;
if(pInfo[playerid][pAdmin] < 5) return 0;
if(sscanf(params, "i", id)) return SM(playerid, -1, ""COL_USAGEONE"Correct Usage: "COL_USAGETWO"/veh (Vehicle ID)");
else
{
//Messages
format(string, sizeof(string), ""COL_ADMIN"ADMIN: "COL_SADMIN"You have spawned a(n) %s.", vehicleName[id]);
SM(playerid, -1, string);
//Peforming
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, Angle);
CreateVehicle(id, x, y, z, Angle, -1, -1, -1);
}
return 1;
}
Thanks in advance.
AW: Help -
Kaliber - 19.03.2015
Quote:
Originally Posted by iFiras
Thanks in advance.
|
Write it like this:
Код:
CMD:veh(playerid, params[])
{
if(pInfo[playerid][pAdmin] < 5) return SM(playerid,-1,"Your Adminlevel is too low!");
new id = strval(params), string[128], Float:x, Float:y, Float:z, Float:Angle;
if(!id) return SM(playerid, -1, ""COL_USAGEONE"Correct Usage: "COL_USAGETWO"/veh (Vehicle ID)");
if(!(400 <= id <= 611)) return SM(playerid,-1,"Invalid vehicle model!");
format(string, sizeof(string), ""COL_ADMIN"ADMIN: "COL_SADMIN"You have spawned a(n) %s.", aVehicleNames[id-400]);
SM(playerid, -1, string);
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, Angle);
CreateVehicle(id, x, y, z, Angle, -1, -1, -1);
return 1;
}
Your mistake was here:
PHP код:
aVehicleNames[id] //Thats wrong because id >= 400..but index <= 211...so you must id-400
Greekz