STRCMP help
#1

I really hope I'm not missing something obvious here, but for some reason it keeps telling me I have an argument type mismatch in my code.

Код:
cmd:goto(playerid, params[])
{
	new location;
	if(!PlayerData[playerid][p_LOGGED_IN]) return false;
    if(PlayerData[playerid][p_ADMINLVL] < 0) return SendClientMessage(playerid, WHITE, CMD_PERM);
    if( sscanf( params, "s", location ) ){
		SendClientMessage(playerid, WHITE, CMD_USAGE"/goto [location]" );
		SendClientMessage(playerid, WHITE, "Locations: gym, lspd, stadium");
		return true;
	}
    else
    {
        if(!strcmp(location, "gym")){
			SetPlayerPos(playerid, 2226.1499,-1722.0465,13.5608);
		} else {
		    SendClientMessage(playerid, WHITE, "Invalid Location");
		}
    }
    return true;
}
Error:
Код:
Script.pwn(590) : error 035: argument type mismatch (argument 1)
Line 590
Код:
if(!strcmp(location, "gym")){
AFAIK STRCMP is string compare so I'm comparing location (which is the user's input) to the string "gym"

Additionally, if there is another way to do such a command instead of doing if/elseif/else statements that'd be nice. Researched and found strings cannot be used as values inside switch statements which would have been really easy.
Reply


Messages In This Thread
STRCMP help - by BR3TT - 26.03.2017, 03:51
Re: STRCMP help - by AndySedeyn - 26.03.2017, 04:09
Re: STRCMP help - by ISmokezU - 26.03.2017, 04:19
Re: STRCMP help - by AndySedeyn - 26.03.2017, 04:25
Re: STRCMP help - by BR3TT - 26.03.2017, 04:39

Forum Jump:


Users browsing this thread: 1 Guest(s)