SetSpawnInfo - spawned with wrong info - 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: SetSpawnInfo - spawned with wrong info (
/showthread.php?tid=475745)
SetSpawnInfo - spawned with wrong info -
dusk - 14.11.2013
Code:
pawn Код:
format(query,sizeof(query),"SELECT X,Y,Z,Interior,VirtualWorld,Skin FROM users WHERE UserId = %d",pInfo[playerid][SqlId]);
mysql_tquery(DbHandle,query,"OnSpawnSetup","i",playerid);
forward OnSpawnSetup(playerid);
public OnSpawnSetup(playerid)
{
SetSpawnInfo(playerid,0,cache_get_row_int(0,5),cache_get_row_int(0,0),cache_get_row_int(0,1),cache_get_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));
SpawnPlayer(playerid);
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..
Re: SetSpawnInfo - spawned with wrong info -
-Prodigy- - 14.11.2013
Do you set the player's skin during OnPlayerSpawn? Besides your function ofc
Re: SetSpawnInfo - spawned with wrong info -
dusk - 15.11.2013
No, this is the only place where I set it, besides when getting a job.
Re: SetSpawnInfo - spawned with wrong info -
Konstantinos - 15.11.2013
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?