Code funktioniert nicht
#1

Hay,

Eigentlich habe ich nie probleme mit dem scripten doch seit ich die Kopfschmerzen habe ist mein Denk vermцgen = 0 .

Folgendes Problem:

Code:
/var/www/SA-MP/Reallife Script/gamemodes/reallife.pwn(176) : error 033: array must be indexed (variable "data")
/var/www/SA-MP/Reallife Script/gamemodes/rreallife.pwn(182) : error 033: array must be indexed (variable "data")
/var/www/SA-MP/Reallife Script/gamemodes/rreallife.pwn(188) : error 033: array must be indexed (variable "data")
Der Code

Code:
    new data[255];
   	new string[256];
  	new playername[256];

	GetPlayerName(playerid,playername,sizeof(playername));
	GetPlayerPos(playerid, X, Y, Z);
	format(string,sizeof(string),"Nickname='%s'",playername);
	mysqlget("userdata",string,"city",data);

//->Problem Zeile (Problem == data)
 	if(data == "ls") {
	    //Spawn(1162.5424,-1489.8722,22.7552,89.7825,); // LS Spawn
	    SetPlayerPos(playerid, 1162.5424, -1489.8722, 22.7552);
	    SetPlayerFacingAngle(playerid, 89.7825);
	    SetPlayerInterior(playerid, 0);
	    SetPlayerVirtualWorld(playerid, 0);
//->Problem Zeile (Problem == data)
	} else if(data == "lv") {
	    //Spawn(1956.5518,1343.0563,15.3746,268.0826); // LV Spawn
	    SetPlayerPos(playerid, 1956.5518,1343.0563,15.3746);
	    SetPlayerFacingAngle(playerid, 268.0826);
	    SetPlayerInterior(playerid, 0);
	    SetPlayerVirtualWorld(playerid, 0);
//->Problem Zeile (Problem == data)
	} else if(data == "sf") {
	    //Spawn(-1973.5686,138.0916,27.6875,90.3823); // SF Spawn
	    SetPlayerPos(playerid, -1973.5686,138.0916,27.6875);
	    SetPlayerFacingAngle(playerid, 90.3823);
	    SetPlayerInterior(playerid, 0);
	    SetPlayerVirtualWorld(playerid, 0);
	}
spawn(); war mal ne lustige funktion von mir. Funktionierte wie ein Teleporter
Wurde auch spдter zu einem Teleporter umgescriptet!
Reply
#2

hi, also mit dem vergleichsoperator (==) kannst du keine strings miteinader vergleichen.
ersetze das:

if(data == "ls")

durch:

if(!strcmp(data, ls, true))
Reply
#3

ach ja.

Danke.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)