SA-MP Forums Archive
Always Show [Error]:Invalid Weapon ID - 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: Always Show [Error]:Invalid Weapon ID (/showthread.php?tid=647186)



Always Show [Error]:Invalid Weapon ID - Speaker - 31.12.2017

Hello When I use The Command And Type The Weapon it It Says Invalid Weapon Id Always
Like If i Used /eweapon1 10 This it Show Invalid Weapon Id

Here's The Code
Код:
CMD:eweapon1(playerid,params[])
{
   if (udb_Exists(PlayerName2(playerid)))
    {
        PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).("Level"));
	}
    if(PlayerInfo[playerid][Level] < 6) return SendClientMessage(playerid,COLOR_YELLOW,"You are not allowed to use this command.");
    if(sscanf(params,"u",params[0])) return SendClientMessage(playerid,COLOR_YELLOW,"[USAGE]: /eweapon1 [weapon id]");
    if(params[0] < 0 || params[0] > 42) return SendClientMessage(playerid,COLOR_YELLOW,"[ERROR]: Invalid Weapon Id");
    eInfo[eWeaps][0] = params[0];
    SendClientMessageToAll(COLOR_YELLOW,"Weapon 1 For Event Have Been Set.");
    return 1;
}



Re: Always Show [Error]:Invalid Weapon ID - JesterlJoker - 31.12.2017

FROM
Quote:

CMD:eweapon1(playerid,params[])
{
if (udb_Exists(PlayerName2(playerid)))
{
PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).("Level"));
}
if(PlayerInfo[playerid][Level] < 6) return SendClientMessage(playerid,COLOR_YELLOW,"You are not allowed to use this command.");
if(sscanf(params,"u",params[0])) return SendClientMessage(playerid,COLOR_YELLOW,"[USAGE]: /eweapon1 [weapon id]");
if(params[0] < 0 || params[0] > 42) return SendClientMessage(playerid,COLOR_YELLOW,"[ERROR]: Invalid Weapon Id");
eInfo[eWeaps][0] = params[0];
SendClientMessageToAll(COLOR_YELLOW,"Weapon 1 For Event Have Been Set.");
return 1;
}

To
Quote:

CMD:eweapon1(playerid,params[])
{
if (udb_Exists(PlayerName2(playerid)))
{
PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).("Level"));
}
if(PlayerInfo[playerid][Level] < 6) return SendClientMessage(playerid,COLOR_YELLOW,"You are not allowed to use this command.");
if(sscanf(params,"d",params[0])) return SendClientMessage(playerid,COLOR_YELLOW,"[USAGE]: /eweapon1 [weapon id]");
if(params[0] < 0 || params[0] > 42) return SendClientMessage(playerid,COLOR_YELLOW,"[ERROR]: Invalid Weapon Id");
eInfo[eWeaps][0] = params[0];
SendClientMessageToAll(COLOR_YELLOW,"Weapon 1 For Event Have Been Set.");
return 1;
}