Help with an error using IsNumeric - 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 with an error using IsNumeric (
/showthread.php?tid=470971)
Help with an error using IsNumeric -
Jacksta21 - 20.10.2013
Hello, yes I've looked this up, but I don't understand whats wrong, other things in my script use the same method in a similar way but this time it just gives an error.
Error: error 035: argument type mismatch (argument 1)
Code:
Код:
CMD:report(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 1338)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You can't submit reports as an administrator.");
return 1;
}
if(PlayerInfo[playerid][pRMuted] != 0)
{
ShowPlayerDialog(playerid,7955,DIALOG_STYLE_MSGBOX,"Report blocked","You are blocked from submitting any reports!\n\nTips when reporting:\n- Report what you need, not who you need.\n- Be specific, report exactly what you need.\n- Do not make false reports.\n- Do not flame admins.\n- Report only for in-game items.\n- For shop orders use the /shoporder command","Close", "");
return 1;
}
if(JustReported[playerid] > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "Wait 25 seconds before sending another report!");
return 1;
}
new playerb, message[64];
if(sscanf(params, "us[64]", playerb, message)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /report [ID] [text]");
if(!IsNumeric(playerb)) //error is here
{
SendClientMessageEx(playerid, COLOR_GRAD1, "USAGE: /report [ID] [text]");
return 1;
}
JustReported[playerid]=25;
SendReportToQue(playerid, playerb, message);
SendClientMessageEx(playerid, COLOR_YELLOW, "Your report message was sent to the Admins.");
return 1;
}
Re: Help with an error using IsNumeric -
Konstantinos - 20.10.2013
IsNumeric uses a string as parameter, not an integer you're trying.
Re: Help with an error using IsNumeric -
Jacksta21 - 20.10.2013
Quote:
Originally Posted by Konstantinos
IsNumeric uses a string as parameter, not an integer you're trying.
|
Oh okay, so how would I check that for example, /report ID TEXT. How would I make sure ID is an integer?
Re: Help with an error using IsNumeric -
kristo - 20.10.2013
sscanf already did it.
Edit: Actually, you are using "u" so the player can type the other player's ID or his/her name. But the playerb is an integer value so you can use it for sure.
Re: Help with an error using IsNumeric -
Jacksta21 - 20.10.2013
Ahhj okay, so I could just use IsPlayerConnected to check if the ID/NAME input is valid?
Re: Help with an error using IsNumeric -
kristo - 21.10.2013
Yes.