What's wrong with SetPlayerSkin()?
#1

Hello,

I retyped my OnPlayerSpawn to let the skin change on spawn
but it's not working, the skin saves on disconnect but I can't
load it when spawning. Here is the code, could you tell me what's
wrong?

Код:
public OnPlayerSpawn(playerid)
{
	new name[MAX_PLAYER_NAME], file[256];
	GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USERS, name);

	if(gLogged[playerid] == 1)
	{
	    if(PlayerInfo[playerid][pLastPosX] != 0.0000 || PlayerInfo[playerid][pLastPosY] != 0.0000 || PlayerInfo[playerid][pLastPosZ] != 0.0000)
	    {
	        if(HasDied[playerid] == 0)
	        {
         		SetPlayerPos(playerid, PlayerInfo[playerid][pLastPosX], PlayerInfo[playerid][pLastPosY], PlayerInfo[playerid][pLastPosZ]);
                SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
                
				new a, b, c, d, e, f, g, h, i, j, k, l, m;
				a = dini_Int(file, "weaponSlot0");
    			b = dini_Int(file, "weaponSlot1");
    			c = dini_Int(file, "weaponSlot2");
    			d = dini_Int(file, "weaponSlot3");
    			e = dini_Int(file, "weaponSlot4");
    			f = dini_Int(file, "weaponSlot5");
    			g = dini_Int(file, "weaponSlot6");
    			h = dini_Int(file, "weaponSlot7");
    			i = dini_Int(file, "weaponSlot8");
    			j = dini_Int(file, "weaponSlot9");
    			k = dini_Int(file, "weaponSlot10");
    			l = dini_Int(file, "weaponSlot11");
    			m = dini_Int(file, "weaponSlot12");

    			GivePlayerWeapon(playerid, a, 1000000000);
    			GivePlayerWeapon(playerid, b, 1000000000);
    			GivePlayerWeapon(playerid, c, 1000000000);
    			GivePlayerWeapon(playerid, d, 1000000000);
    			GivePlayerWeapon(playerid, e, 1000000000);
    			GivePlayerWeapon(playerid, f, 1000000000);
    			GivePlayerWeapon(playerid, g, 1000000000);
    			GivePlayerWeapon(playerid, h, 1000000000);
    			GivePlayerWeapon(playerid, i, 1000000000);
    			GivePlayerWeapon(playerid, j, 1000000000);
    			GivePlayerWeapon(playerid, k, 1000000000);
    			GivePlayerWeapon(playerid, l, 1000000000);
    			GivePlayerWeapon(playerid, m, 1000000000);
			}
			if(HasDied[playerid] == 1)
			{
			    SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				new rand = random(sizeof(RandomHospital));
				SetPlayerPos(playerid, RandomHospital[rand][0], RandomHospital[rand][1],RandomHospital[rand][2]);
				SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				HasDied[playerid] = 0;
				SendClientMessage(playerid, COLOR_WHITE, "(( You have lost 30 minutes of memory, please take care for your RP behavior. ))");
				SendClientMessage(playerid, COLOR_LRED,  "Doctor: Your medical bill came up to $200, have a nice day!");
				GivePlayerMoney(playerid, -200);
				ResetPlayerWeapons(playerid);
			}
		}
		else
		{
			SetPlayerPos(playerid, 2232.1982,-1159.5858,25.8906);
			SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
			SetPlayerFacingAngle(playerid, 89.9141);
		}
	}
	else
	{
	    SendClientMessage(playerid, COLOR_RED, "  You must login before spawn. ((Kicked))");
	    Kick(playerid);
	}
	return 1;
}
Thanks.
Reply
#2

Bump (1)
Reply
#3

I dont see that you are loadning the skin from the file in the script? Add something like this.
pawn Код:
PlayerInfo[playerid][pSkin] = dini_Int(file, "Skin");
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
Reply
#4

Huh? I don't get it? You mean every time the player respawns u want there skin to change?
Reply
#5

Quote:
Originally Posted by Fj0rtizFredde
Посмотреть сообщение
I dont see that you are loadning the skin from the file in the script? Add something like this.
pawn Код:
PlayerInfo[playerid][pSkin] = dini_Int(file, "Skin");
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
Hi,

thanks that you said this. I see that I have forgotten to define it. :P
It works now, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)