Problems when Spawning player
#1

Hey people!

I've got a strange problem.

I've got a function to spawn my objects. Those are stored in a MySQL Database.
It actually works very well.

But somehow when the count of objects is more than 59 I get problems with my player spawn.
Somehow my SetSpawnInfo and SpawnPlayer function won't work anymore.

If I spawn less den 60 objects my script works just as I want.

Код:
public AddObjects() {
	new string[256] = "SELECT * FROM objects";
	mysql_query(string);
	mysql_store_result();
	while(mysql_fetch_row(string)) {
		new dest[50][30];
		split(string, dest);
		printf("Adding Object ID: %s", dest[0]);
	        CreateObject(strval(dest[1]), floatstr(dest[3]), floatstr(dest[4]), floatstr(dest[5]), floatstr(dest[6]), floatstr(dest[7]), floatstr(dest[8]));
	}
	mysql_free_result();
}
Maybe you could help me.
Thx
Reply
#2

There's actually seemingly no problem here. Plus, I would recommend you to use R7 plugin using threaded queries ! Without all of this split and fetch row, you could create them in your callback. Anyways, can you share the OnPlayerSpawn code?
Reply
#3

Thx I will have a look at the R7 plugin, I'm new to SA-MP and used the first I found.

Well there isn't much in that callback and I can't think of anything that could have to do with my problem.

Код:
public OnPlayerSpawn(playerid)
{
	if(PlayerInfo[playerid][pLogged] != 1 && PlayerInfo[playerid][pTut] != 1) {
	    SendClientMessage(playerid, COLOR_RED, "You must login!");
	    Kick(playerid);
	} else if(PlayerInfo[playerid][pTut] == 1) {
    	TogglePlayerControllable(playerid, 0);
    	showTutorial(playerid);
		tuttimer = SetTimerEx("showTutorial", 5000, true, "i",playerid);
	} else {
    	TogglePlayerControllable(playerid, 1);
    }
	return 1;
}
Edit:
I've found a solution for my problem!
It seems like it takes some time to spawn the objects at the client. So it seems like I have to wait until I show the Login Dialog. Currently I have a timer which waits 2 seconds until showing the dialog and then everything works fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)