SA-MP Forums Archive
Not spawning correct - 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: Not spawning correct (/showthread.php?tid=596518)



Not spawning correct - Alex_T - 19.12.2015

When the player spawns they are not being spawned off were the cords are in the mysql.



Код:
forward OnLoadCharacter(playerid, charid);
public OnLoadCharacter(playerid, charid) {
	new id_string[128];
	new rows,fields;
	cache_get_data(rows,fields);
	
	cache_get_row(0, 0, id_string);
	SetPVarInt(playerid, "Money", strval(id_string));
	SetPlayerMoneyEx(playerid, GetPVarInt(playerid, "Money"));
	
	
	cache_get_row(0, 1, id_string);
	SetPVarInt(playerid, "Score", strval(id_string));
	
	
	cache_get_row(0, 2, id_string);
	SetPVarInt(playerid, "Deaths", strval(id_string));
	
	
	cache_get_row(0, 3, id_string);
	SetPVarInt(playerid, "Kills", strval(id_string));
	
	new X,Y,Z;
	cache_get_row(0, 4, id_string);
	X = strval(id_string);
	SetPVarFloat(playerid, "X", X);
	
	cache_get_row(0, 5, id_string);
	Y = strval(id_string);
	SetPVarFloat(playerid, "Y", Y);
	
	
	cache_get_row(0, 6, id_string);
	Z = strval(id_string);
	SetPVarFloat(playerid, "Z", Z);
	
	cache_get_row(0, 7, id_string);
	SetPVarInt(playerid, "FacingAngle", strval(id_string));
	
	cache_get_row(0, 8, id_string);
	SetPVarInt(playerid, "Interior", strval(id_string));
	
	cache_get_row(0, 9, id_string);
	SetPVarInt(playerid, "Age", strval(id_string));
	
	cache_get_row(0, 10, id_string);
	SetPVarInt(playerid, "Sex", strval(id_string));
	
	cache_get_row(0, 11, id_string);
	SetPVarInt(playerid, "VW", strval(id_string));
	
	cache_get_row(0, 12, id_string);
	SetPVarInt(playerid, "SkinID", strval(id_string));
	
	cache_get_row(0, 13, id_string);	
	SetPVarString(playerid, "CharacterName", id_string);
	SetPlayerName(playerid, id_string);
	
	cache_get_row(0, 14, id_string);
	SetPVarInt(playerid, "CharID", strval(id_string));
	
	cache_get_row(0, 15, id_string);
	SetPVarInt(playerid, "BankMoney", strval(id_string));
	
	SetPVarInt(playerid, "SwitchChar", 0);
	TogglePlayerSpectating(playerid, 0);
	
	SetSpawnInfo(playerid, 0, GetPVarInt(playerid, "SkinID"), X, Y, Z, GetPVarInt(playerid,"FacingAngle"),0,0,0,0,0,0);
	SpawnPlayer(playerid);



Re: Not spawning correct - X337 - 19.12.2015

Код:
	new Float:X,Float:Y,Float:Z;
	cache_get_row(0, 4, id_string);
	X = floatstr(id_string);
	SetPVarFloat(playerid, "X", X);
	
	cache_get_row(0, 5, id_string);
	Y = floatstr(id_string);
	SetPVarFloat(playerid, "Y", Y);
	
	
	cache_get_row(0, 6, id_string);
	Z = floatstr(id_string);
	SetPVarFloat(playerid, "Z", Z);
	
	cache_get_row(0, 7, id_string);
	SetPVarInt(playerid, "FacingAngle", floatstr(id_string));