SA-MP Forums Archive
old skin? - 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: old skin? (/showthread.php?tid=384416)



old skin? - xMCx - 11.10.2012

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?


Re: old skin? - Glint - 11.10.2012

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).


Re: old skin? - gtakillerIV - 11.10.2012

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); 



Re: old skin? - xMCx - 11.10.2012

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;




Re: old skin? - Riddick94 - 11.10.2012

Before:

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


Re: old skin? - xMCx - 11.10.2012

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



Re: old skin? - xMCx - 12.10.2012

help..


Re: old skin? - Glint - 12.10.2012

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


Re: old skin? - Lordzy - 12.10.2012

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




Re: old skin? - CrazyChoco - 12.10.2012

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 ?