SA-MP Forums Archive
Skin Problem - 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: Skin Problem (/showthread.php?tid=640632)



Skin Problem - MadGuy - 05.09.2017

Hi Guyz,I have made a adminduty command in which the player goes into admin mode.The problem is that whenever i do /aduty the player changes the skin to which i have set into pwn but when the player again do /aduty to turnoff the admin duty,the player gets CJ'S Skin,I want that the player will get his old skin that he has choosen before spawning,Help me...My Command :
Код:
COMMAND:adminduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdminlevel] > 0)
	{
	if(AdminDuty[playerid] == 1)
	{
	SetPlayerToTeamColor(playerid);
	SetPlayerSkin(playerid,OldSkin[playerid]);
	SendClientMessage(playerid,COLOR_ADMIN,"Admin Duty Is Now OFF.");

	SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);

	AdminDuty[playerid] = 0;
	OldSkin[playerid] = GetPlayerSkin(playerid);
	}else{
	
	SendClientMessage(playerid,COLOR_ADMIN,"Admin Duty Is Now ON.");

	GivePlayerWeapon(playerid, 38, 9999999);
	SetPlayerColor(playerid,COLOR_ADMIN);
    SetPlayerSkin(playerid, 217);
	AdminDuty[playerid] = 1;
	}
	}else{
	SendClientMessage(playerid,COLOR_ERROR,""ERROR_MSG"");
	}
    return 1;
}



Re: Skin Problem - Kane - 05.09.2017

Re read your code.

You're setting their skin to OldSkin when they go off admin duty. Then you grab their skin in the same sequence.

Код:
OldSkin[playerid] = GetPlayerSkin(playerid);
Put that ABOVE SetPlayerSkin when they go ON.


Re: Skin Problem - MadGuy - 05.09.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Re read your code.

You're setting their skin to OldSkin when they go off admin duty. Then you grab their skin in the same sequence.

Код:
OldSkin[playerid] = GetPlayerSkin(playerid);
Put that ABOVE SetPlayerSkin when they go ON.
I didn't understand bro,Can you please edit my Code?


Re: Skin Problem - Kane - 05.09.2017

Код:
COMMAND:adminduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdminlevel] > 0)
	{
	if(AdminDuty[playerid] == 1)
	{
	SetPlayerToTeamColor(playerid);

	SetPlayerSkin(playerid,OldSkin[playerid]);
         //You're setting their skin to OldSkin. OldSkin is 0 right now.

	SendClientMessage(playerid,COLOR_ADMIN,"Admin Duty Is Now OFF.");

	SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);

	AdminDuty[playerid] = 0;
	OldSkin[playerid] = GetPlayerSkin(playerid);
        //You're using GetPlayerSkin for OldSkin when you already set their skin. Still remains 0. 
	}else{
	
	SendClientMessage(playerid,COLOR_ADMIN,"Admin Duty Is Now ON.");

	GivePlayerWeapon(playerid, 38, 9999999);
	SetPlayerColor(playerid,COLOR_ADMIN);
    SetPlayerSkin(playerid, 217);
        //You set their skin to 217. This is when they go ON DUTY. How's their old skin saved?
	AdminDuty[playerid] = 1;
	}
	}else{
	SendClientMessage(playerid,COLOR_ERROR,""ERROR_MSG"");
	}
    return 1;
}
Read my highlights. Do you understand?

Код:
COMMAND:adminduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdminlevel] > 0)
	{
	if(AdminDuty[playerid] == 1)
	{
	SetPlayerToTeamColor(playerid);
	SetPlayerSkin(playerid,OldSkin[playerid]);
	SendClientMessage(playerid,COLOR_ADMIN,"Admin Duty Is Now OFF.");

	SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);

	AdminDuty[playerid] = 0;
	}else{
	
	SendClientMessage(playerid,COLOR_ADMIN,"Admin Duty Is Now ON.");

	GivePlayerWeapon(playerid, 38, 9999999);
	SetPlayerColor(playerid,COLOR_ADMIN);

     OldSkin[playerid] = GetPlayerSkin(playerid);
    SetPlayerSkin(playerid, 217);
	AdminDuty[playerid] = 1;
	}
	}else{
	SendClientMessage(playerid,COLOR_ERROR,""ERROR_MSG"");
	}
    return 1;
}



Re: Skin Problem - MadGuy - 05.09.2017

Thanks Man,It works!