SA-MP Forums Archive
Help Me /skin CMD - 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: Help Me /skin CMD (/showthread.php?tid=567177)



Help Me /skin CMD - GlaL - 11.03.2015

Please Help i need a /skin [id] script like
/skin 123
it changes your skin to 123 + i want to make it if player registred it makes when player login he uses his saved skin id automatic


Re: Help Me /skin CMD - CalvinC - 11.03.2015

Watch some sscanf and saving tutorials, this isn't a section to request scripts.
If you get problems, then we can help you with those problems.
If you want to request scripts, go here.
Quote:
Originally Posted by Forum Rules
Script Requests - If you are requesting a script be made for you, rather than help with your coding, post in the Looking for scripters/helpers? Post here! Thread.



Re: Help Me /skin CMD - NoDi522 - 11.03.2015

PHP код:
CMD:setskin(playerid,params[])
{
    new 
SkinBroj,SkinID,poruka[128];
    if(
PlayerInfo[playerid][pAdministrator] <= 2) return SendClientMessage(playerid, -1,"Error: you don't have permission);
    else if(SkinID < 0 || SkinID > 299) return SendClientMessage(playerid,-1,"
ErrorChose your skin in 299 ]");
    if(sscanf(params,"
d",SkinID)) return SendClientMessage(playerid,-1,"Syntax: /setskin (Skin ID)");
    else
    {
        SetPlayerSkin(playerid,SkinID);
        SkinBroj = GetPlayerSkin(playerid);
        format(poruka,sizeof(poruka),"
You have chosen new skinID: %d",SkinBroj);
        SendClientMessage(playerid,-1,poruka);
    }
    return 1;

You have to:
-
PHP код:
#include <ZCMD>
#include <sscanf> 
+ If you don't have download and put sscanf plugin into your "plugins" folder and add in server.cfg line: plugins sscanf

Here you go!


Respuesta: Help Me /skin CMD - JuanStone - 11.03.2015

PHP код:
#include <a_samp>
#include <sscanf2>
#include <YSI\y_ini>
#include <YSI\y_inline>
#include <YSI\y_commands> // or zcmd
new gskin[MAX_PLAYERS];
CMD:skin(playeridparams[])
{
    if(
sscanf(params"i"params[0]))
        return 
SendClientMessage(playerid, -1"usage: /skin [id].");
    if(
params[0] < || params[0] > 299)
        return 
SendClientMessage(playerid, -1"ID invalid, min 0 max 299.");
    
SetPlayerSkin(playeridparams[0]);
    
SendClientMessage(playerid, -1"Hass been changen your skin.");
    return 
true;
}
public 
OnPlayerSpawn(playerid)
{
    if(
fexist(Folderskins(playerid)))
    {
        
SetPlayerSkin(playeridgskin[playerid]);
    }
    return 
true;
}
public 
OnPlayerRequestSpawn(playerid)
{
    if(
fexist(Folderskins(playerid)))
    {
        
inline loadskin(string:name[], string:value[])
        {
            
INI_Int("skin"gskin[playerid]);
        }
        
INI_ParseFile(Folderskins(playerid), "loadskin");
        
SetPlayerSkin(playeridgskin[playerid]);
    }
    return 
true;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(Folderskins(playerid))    ;
    
INI_SetTag(File"Skin user");
    
INI_WriteInt(File"Skin"GetPlayerSkin(playerid));
    
INI_Close(File);
    return 
true;
}
Folderskins(playerid)
{
    new 
Name[MAX_PLAYER_NAME+1], string[85];
    
GetPlayerName(playeridNamesizeof(Name));
    
format(stringsizeof(string), "/namefolder/%s.ini"Name);
    return 
string;