old skin?
#1

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

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

Quote:
Originally Posted by Glint
Посмотреть сообщение
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).
Like Glint said.

Ex:

PHP код:
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); 
Reply
#4

where exactly?
PHP код:
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,z40.000); 
            
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.00.00.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,z40.000);
            
Delete3DTextLabel(label); 
            
SetPlayerHealth(playerid,100); 
            
format(string,sizeof(string)," %s is now off Duty!",GetPlayerNameEx(playerid)); 
            
SendClientMessageToAll(0x008080AA,string); 
            
SendClientMessage(playeridred"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;

Reply
#5

Before:

pawn Код:
SetPlayerSkin(playerid,217);
Save your skin, and then bring it back after else if statement.
Reply
#6

after else if:
PHP код:
SetPlayerSkin(playerid,oldskin); 
Reply
#7

help..
Reply
#8

Quote:
Originally Posted by xMCx
Посмотреть сообщение
help..
Help on what ? Didn't it work already ?
Reply
#9

PHP код:
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,z40.000);  
            
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.00.00.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,z40.000); 
            
Delete3DTextLabel(label);  
            
SetPlayerHealth(playerid,100);
            
SetPlayerSkin(playerid,oldskin);
            
format(string,sizeof(string)," %s is now off Duty!",GetPlayerNameEx(playerid));  
            
SendClientMessageToAll(0x008080AA,string);  
            
SendClientMessage(playeridred"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

Reply
#10

Why people always want it all served in a silver plate? Read around instead of asking how to get it inside of the code. You wont learn a single code by copy & paste. Read wiki maybe ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)