SA-MP Forums Archive
Argument Type Mismatch (argument 1) - 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 (argument 1) (/showthread.php?tid=429019)



Argument Type Mismatch (argument 1) - Mattakil - 07.04.2013

So, im trying to open some prison gates when the password "gov123" is entered, and I screwed up somewhere, ill rep for the answer

Код:
CMD:gate(playerid, params[])
{
    new
        subcmd[ 6 ],
        password;

    if( sscanf( params, "ss", subcmd, password ))
        return SendClientMessage( playerid, 0xFFFFFFFF, "/gate [open/close] [password]" );

    if( !strcmp( subcmd, "open", true ))
    {
         if( !strcmp( password, "gov123", true )) <====ERROR
         {
             if(IsPlayerInRangeOfPoint(playerid, 5.0, -2819.3171,  2651.5464, 103.3268))
				{
				MoveObject(pgate1, -2819.3171, 2648.8591, 103.3268, 3.0);
				return 1;
				}
			if(IsPlayerInRangeOfPoint(playerid, 5.0, -2855.7876, 2659.5562, 107.6278))
				{
				MoveObject(pgate2, -2855.7678, 2656.9021, 107.6278, 3.0));
				return 0;
				}
         }
    }
    else
    {
        if(IsPlayerInRangeOfPoint(playerid, 5.0, -2819.3171,  2651.5464, 103.3268))
				{
				MoveObject(pgate1, -2819.3171,  2651.5464, 103.3268, 3.0);
				return 1;
				}
  			if(IsPlayerInRangeOfPoint(playerid, 5.0, -2855.7876, 2659.5562, 107.6278))
				{
				MoveObject(pgate2, -2855.7678, 2659.5361, 107.6278, 3.0);
				return 1;
				}
    }
    return true;
}



Re: Argument Type Mismatch (argument 1) - [CG]Milito - 07.04.2013

Post the line that is getting errors

EDIT: Sorry, Didn't see the line you marked


Re: Argument Type Mismatch (argument 1) - Mattakil - 07.04.2013

RESOLVED, used 2 commands for the gates


Re: Argument Type Mismatch (argument 1) - HurtLocker - 07.04.2013

Try this:
pawn Код:
CMD:gate(playerid, params[])
{
    new subcmd[4], password[6];

    if (!sscanf(params, "s[4]s[6]", subcmd, password))
    {
        if (strcmp(subcmd, "open", true)==0)
        {
            if(strcmp(password, "gov123", true)==0)
            {
                if(IsPlayerInRangeOfPoint(playerid, 5.0, -2819.3171,  2651.5464, 103.3268))
                            {
                                MoveObject(pgate1, -2819.3171, 2648.8591, 103.3268, 3.0);
                                return 1;
                }
                else if(IsPlayerInRangeOfPoint(playerid, 5.0, -2855.7876, 2659.5562, 107.6278))
                {
                                MoveObject(pgate2, -2855.7678, 2656.9021, 107.6278, 3.0));
                                return 1;
                }
                else if(IsPlayerInRangeOfPoint(playerid, 5.0, -2819.3171,  2651.5464, 103.3268))
                            {
                                MoveObject(pgate1, -2819.3171,  2651.5464, 103.3268, 3.0);
                    return 1;
                }
                       else if(IsPlayerInRangeOfPoint(playerid, 5.0, -2855.7876, 2659.5562, 107.6278))
                            {
                                MoveObject(pgate2, -2855.7678, 2659.5361, 107.6278, 3.0);
                                return 1;
                }
            }
            else return SendClientMessage( playerid, 0xFFFFFFFF, "Wrong password!" );
        }
        else return SendClientMessage( playerid, 0xFFFFFFFF, "/gate [open/close] [password]");
    }
    else return SendClientMessage( playerid, 0xFFFFFFFF, "/gate [open/close] [password]" );
    return 1;
}