error 033: array must be indexed (variable "text")
#1

Pawno give me warning:error 033: array must be indexed (variable "text")
I want to check string is same
Please tell me how do I do that.
Код:
TeleportPlayer(playerid, Float:x, Float:y, Float:z, Float:a, interiorid = 0, worldid = 0, text[] = "", freeze = 0)//非常重要的
{
	SetPlayerInterior(playerid, interiorid);
	SetPlayerVirtualWorld(playerid, worldid);
	SetCameraBehindPlayer(playerid);
	SetPVarInt(playerid,"IIH",0);
	if(	IsPlayerInAnyVehicle(playerid) &&
		GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
	    foreach(new i : Player)
	    {
	        if(	GetPlayerVehicleID(i) == vehicleid &&
				i != playerid)
			{
			    SetPlayerInterior(i, interiorid);
			    SetPlayerVirtualWorld(i, worldid);
			}

			if(GIV(playerid)==0){LinkVehicleToInterior(vehicleid, interiorid);}
			SetVehicleVirtualWorld(vehicleid, worldid);

			SetVehiclePos(vehicleid, x, y, z);
			SetVehicleZAngle(vehicleid, a);
	    }
	}
	else
	{
	    SetPlayerPos(playerid, x, y, z);
	    if(a != 0){SetPlayerFacingAngle(playerid, a);}
	}
	if(freeze==1){Freeze(playerid);}
	if(text!="none")//This line warning!!!
	{
    new string[128], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    format(string, sizeof(string), text, pName);
    SendClientMessageToAll(ServerColors[random(sizeof(ServerColors))], string);
    }
	return 1;
}
Reply
#2

No need to add ="" after text[] in function heading.
Reply
#3

PHP код:
if(text!="none")//This line warning!!! 
Use strcmp when comparing strings.
PHP код:
if( strcmp(text"none") ) 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)