error 033: array must be indexed (variable "text") - 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: error 033: array must be indexed (variable "text") (
/showthread.php?tid=655342)
error 033: array must be indexed (variable "text") -
3417512908 - 19.06.2018
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;
}
Re: error 033: array must be indexed (variable "text") -
GTLS - 19.06.2018
No need to add
="" after text[] in function heading.
Re: error 033: array must be indexed (variable "text") -
coool - 19.06.2018
PHP код:
if(text!="none")//This line warning!!!
Use strcmp when comparing strings.
PHP код:
if( strcmp(text, "none") )