11.10.2012, 19:42
i have aduty command , when i go on duty i get skinid 217 , but when i get back off duty it stay the same ive tried to make it as the old 1 but i failed , can you help me?
Create a variable get player's skin then save it into that variable, and when he goes off-duty set his skin to that variable (which his original skin is store at).
|
new oldskin[MAX_PLAYERS]; //Global variable, add it after your #define's
//In your command at the VERY TOP and if you have errors like wrong params..etc then add that line after them
oldskin[playerid]=GetPlayerSkin(playerid);
CMD:aduty(playerid)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if (aDuty[playerid] == 0)
{
new string[128];
new Float:x,Float:y,Float:z;
new Text3D:label = Create3DTextLabel("Admin On Duty!", red,x,y,z, 40.0, 0, 0);
GetPlayerPos(playerid,x,y,z);
SetPlayerHealth(playerid,999999);
SetPlayerColor(playerid,red);
SetPlayerSkin(playerid,217);
format(string,sizeof(string), "%s is now on Duty!",GetPlayerNameEx(playerid));
SendClientMessageToAll(red,string);
SendClientMessage(playerid,red,"You are now on duty!");
Attach3DTextLabelToPlayer(label,playerid,0.0, 0.0, 0.7);
aDuty[playerid] = 1;
}
else if (aDuty[playerid] == 1)
{
new string[128];
new Float:x,Float:y,Float:z;
new Text3D:label = Create3DTextLabel("Admin On Duty!", red,x,y,z, 40.0, 0, 0);
Delete3DTextLabel(label);
SetPlayerHealth(playerid,100);
format(string,sizeof(string)," %s is now off Duty!",GetPlayerNameEx(playerid));
SendClientMessageToAll(0x008080AA,string);
SendClientMessage(playerid, red, "You are now off duty!");
aDuty[playerid] = 0;
}
}
else
SendClientMessage(playerid,red,"You are not high level enough!"); //Error message to send to players who arent admins
return 1;
}
SetPlayerSkin(playerid,217);
SetPlayerSkin(playerid,oldskin);
CMD:aduty(playerid)
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if (aDuty[playerid] == 0)
{
new string[128];
new Float:x,Float:y,Float:z;
new oskin;
new Text3D:label = Create3DTextLabel("Admin On Duty!", red,x,y,z, 40.0, 0, 0);
GetPlayerPos(playerid,x,y,z);
oskin = GetPlayerSkin(playerid);
SetPlayerHealth(playerid,999999);
SetPlayerColor(playerid,red);
SetPlayerSkin(playerid,217);
format(string,sizeof(string), "%s is now on Duty!",GetPlayerNameEx(playerid));
SendClientMessageToAll(red,string);
SendClientMessage(playerid,red,"You are now on duty!");
Attach3DTextLabelToPlayer(label,playerid,0.0, 0.0, 0.7);
aDuty[playerid] = 1;
}
else if (aDuty[playerid] == 1)
{
new string[128];
new Float:x,Float:y,Float:z;
new Text3D:label = Create3DTextLabel("Admin On Duty!", red,x,y,z, 40.0, 0, 0);
Delete3DTextLabel(label);
SetPlayerHealth(playerid,100);
SetPlayerSkin(playerid,oldskin);
format(string,sizeof(string)," %s is now off Duty!",GetPlayerNameEx(playerid));
SendClientMessageToAll(0x008080AA,string);
SendClientMessage(playerid, red, "You are now off duty!");
aDuty[playerid] = 0;
}
}
else
SendClientMessage(playerid,red,"You are not high level enough!"); //Error message to send to players who arent admins
return 1;
}