View Full Version : SetSpawnInfo - spawned with wrong info

14/11/2013, 06:46 PM
format(query,sizeof(query),"SELECT X,Y,Z,Interior,VirtualWorld,Skin FROM users WHERE UserId = %d",pInfo[playerid][SqlId]);

forward OnSpawnSetup(playerid);
public OnSpawnSetup(playerid)
SetSpawnInfo(playerid,0,cache_get_row_int(0,5),cac he_get_row_int(0,0),cache_get_row_int(0,1),cache_g et_row_int(0,2),0.0,0,0,0,0,0,0);
SetPlayerInterior(playerid,cache_get_row_int(0,3)) ;
SetPlayerVirtualWorld(playerid,cache_get_row_int(0 ,4));
printf("[%s]skin:%d, X:%f",pInfo[playerid][Username],cache_get_row_int(0,5),cache_get_row_float(0,0));
MainTimer[playerid] = SetTimerEx("MainTimerFunction",60000,true,"i",playerid);
return 1;

And I spawn at the correct position, but the skin is wrong. Although it's printed correctly..

14/11/2013, 06:55 PM
Do you set the player's skin during OnPlayerSpawn? Besides your function ofc

15/11/2013, 06:52 AM
No, this is the only place where I set it, besides when getting a job.

15/11/2013, 10:10 AM
I don't know what the problem is but why don't you set a variable to true in OnSpawnSetup and when OnPlayerSpawn is called, check if it's true and set the skin there by SetPlayerSkin (store it somewhere of course) and then set the variable to false.

PS: Aren't the X, Y, Z floats? Why don't you use cache_get_row_float instead?