26.03.2017, 03:51
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.
Error:
Line 590
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.
Код:
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; }
Код:
Script.pwn(590) : error 035: argument type mismatch (argument 1)
Код:
if(!strcmp(location, "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.