Argument Type Mismatch - 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: Argument Type Mismatch (
/showthread.php?tid=644027)
Argument Type Mismatch -
Uvais - 02.11.2017
Код:
CMD:unban(playerid, params[])
{
new targetname[24], filestring[79];
if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, TOMATO, "[USAGE]: {FFFFFF}/unban [Player's Name]");
format(filestring, sizeof(filestring), "/Users/%s.ini", targetname);
if(!fexist(filestring)) return SendClientMessage(playerid, RED, "[ERROR]: {FFFFFF}Player name not found in database.");
else
{
new INI:
File = INI_Open(UserPath(filestring));
INI_SetTag(File, "data");
INI_WriteInt(File, "Banned", 0);
INI_Close(File);
new done[128];
format(done, sizeof(done), "[UNBAN]: {FFFFFF}You have unbanned the account %s", targetname);
SendClientMessage(playerid,GREEN , done);
}
return 1;
}
Trying to make an offline unban command but get this error
Код:
error 035: argument type mismatch (argument 1)
Re: Argument Type Mismatch -
iDayZ - 02.11.2017
I haven't worked with INI as far as I remember, however I suggest you to try changing filestring with targetname in UserPath().
Re: Argument Type Mismatch -
Lokii - 02.11.2017
PHP код:
new INI:
File = INI_Open(filestring);
or
PHP код:
new INI:
File = INI_Open(UserPath(targetid)); //not the name the id of the target!
Re: Argument Type Mismatch -
Uvais - 03.11.2017
Replacing it to targetid or targetname doesn't fix it, still the same error. How can we use target id when the player is offline? This is an unban command.
Re: Argument Type Mismatch -
Uvais - 03.11.2017
Sorry, didn't see your first code. It's fixed after changing it to
Код:
new INI:
File = INI_Open(filestring);
Repped.