SA-MP Forums Archive
Need help with skin loading - 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: Need help with skin loading (/showthread.php?tid=476452)



Need help with skin loading - Gediminas123 - 18.11.2013

Hello.I was creating register/login system and i have problem.When i register and select male gender its all okey,sets skin,give money,saves skin but when i login with this account then been sets CJ skin and didn't show my money,but in the mysql table,shows everything good,shows money,shows right skin.With female gender its all fine when register and login,saves skin,saves money,loads skin.I just not understand why whit male gender are problem.I can show my code.
Код:
public OnPlayerSpawn(playerid)
{
	if(PlayerData[playerid][Prisijungimo_busena] == true)
	{
  		if(PlayerData[playerid][Lytis] == 0)
  		{
 			 SetPlayerSkin(playerid, 98);
  		}
  		if(PlayerData[playerid][Lytis] == 1)
  		{
  			SetPlayerSkin(playerid, 41);
  		}
	}
	return 1;
}
Код:
	if(dialogid == 2)
	{
        if(response)
 		{
 			new pName[MAX_PLAYER_NAME],Query[500];
			GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
			format(Query,500,"UPDATE `"TABLENAME"` SET pinigai ='5000',skin ='98',lytis ='0' WHERE vardas ='%s'",pName);
			mysql_query(Query);
			SetPlayerScore(playerid,100);
			PlayerData[playerid][Lytis] = 0;
			SetSpawnInfo(playerid, -1, 98, 689.8032,-537.9089,16.3359, 0.0, 0, 0, 0, 0,0,0);
		    SendClientMessage(playerid,green,"Lytis buvo nustatyta sėkmingai į vyriљką");
	        SpawnPlayer(playerid);
		}
		if(!response)
		{
			new pName[MAX_PLAYER_NAME],Query[500];
			GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
			format(Query,500,"UPDATE `"TABLENAME"` SET pinigai ='5000',skin ='41',lytis ='1' WHERE vardas ='%s'",pName);
			mysql_query(Query);
			SetPlayerScore(playerid,100);
   			PlayerData[playerid][Lytis] = 1;
			SetSpawnInfo(playerid, -1, 41, 689.8032,-537.9089,16.3359, 0.0, 0, 0, 0, 0,0,0);
		    SendClientMessage(playerid,green,"Lytis buvo nustatyta sėkmingai į moteriљką");
		    SpawnPlayer(playerid);
 		}
		return 1;
	}
	return 0;
}
Код:
stock SavePlayer(playerid)
{
	new pName[MAX_PLAYER_NAME],Query[500];
	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	format(Query,500,"UPDATE `"TABLENAME"` SET pinigai ='%i',skin ='%i',lytis ='%i' WHERE vardas ='%s'", GetPlayerMoney(playerid),GetPlayerSkin(playerid),PlayerData[playerid][Lytis],pName);
	mysql_query(Query);
Код:
stock LoadStats(playerid)
{
	new pName[MAX_PLAYER_NAME], Query[100], result[100], sqlline[900];
	GetPlayerName(playerid,pName, MAX_PLAYER_NAME);
	format(Query, sizeof(Query), "SELECT * FROM `vartotojai` WHERE `vardas` = '%s'", pName);
	mysql_query(Query);
	mysql_store_result();
	mysql_fetch_row(sqlline);

	mysql_get_field("pinigai", result);
	GivePlayerMoney(playerid, strval(result));
	
	mysql_get_field("skin", result);
	PlayerData[playerid][skin] = strval(result);
	SetPlayerSkin(playerid, PlayerData[playerid][skin]);
	
	mysql_get_field("lytis", result);
	PlayerData[playerid][Lytis] = strval(result);
	
	mysql_free_result();
	return 1;
}
If you need more code,just tell me.Sorry for my english language.


Re: Need help with skin loading - Gediminas123 - 18.11.2013

HELP