Skin Problem
#1

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;
}
Reply
#2

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.
Reply
#3

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?
Reply
#4

Код:
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;
}
Reply
#5

Thanks Man,It works!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)