Save skin help
#1

Hey,
I have created my own registration system, it saves Score,Cash,Kills,Deaths.
But it must be saved the choosen skin to.
I know how to make it, but can anyone give me an example how to make an skin command and save with ZCMD and Y_ini, I dont really know how to fix that..
Because I tried it and readed some tuts but nothing with zcmd + y_ini

Thanks
Reply
#2

PHP код:
INI_WriteInt(File,"skin",GetPlayerSkin(playerid)); 
I think this would help.
Reply
#3

I know that got I already look:

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_WriteInt(File,"Skin",PlayerInfo[playerid][pDeaths]);
    
INI_Close(File);
    return 
1;

and:




PHP код:
public LoadUser_data(playerid,name[],value[])
{
    
INI_Int("Password",PlayerInfo[playerid][pPass]);
    
INI_Int("Cash",PlayerInfo[playerid][pCash]);
    
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    
INI_Int("Kills",PlayerInfo[playerid][pKills]);
    
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    return 
1;

PHP код:
enum pInfo
{
    
bool:pBanned,
    
pPass,
    
pCash,
    
pAdmin,
    
pKills,
    
pDeaths,
    
pSkin

Reply
#4

PHP код:
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)); 
Do it like you did the cash one.
PHP код:
INI_WriteInt(File,"skin",GetPlayerskin(playerid)); 
This would save.
PHP код:
 INI_WriteInt(File,"Skin",PlayerInfo[playerid][pDeaths]); 
replace this with the upper one.
Reply
#5

Ahh oke ty man,
This is my CMD for the skin:

PHP код:
CMD:skin(playerid,params[])
{
    new 
id;
    if(
cmdtext"d"id)) SendClientMessage(playeridCOL_ORANGE"You must be type /skin <skinid>");
        if(
id 300)
        {
            
SetPlayerSkin(playeridid);
        }
        else 
SendClientMessage(playeridCOL_ORANGE"Sorry, that skinID is invalid. There are only skin 0 to 299.");
        return 
1;
    }
    return 
0;

But this didnt work, whats wrong with it
Reply
#6

PHP код:
CMD:skin(playerid,params[])
{
    new 
id;
    if(
sscanf(params,"i",id)) return SendClientMessage(playerid,-1,"USAGE : /skin id \nCost : $50");
    if(
id<|| id>299) return SendClientMessage(playerid,-1,"Invalid ID : Usable ID 0-299");
    
SetPlayerSkin(playerid,id);
    new 
msg[50];
    
format(msg,sizeof(msg),"Your skin ID Is %d",id);
    return 
SendClientMessage(playerid,-1,msg);

Try this.
Reply
#7

Ahh thanks! Now I got these errors:

Quote:

D:\GTA San Andreas\PlanetS\pawno\test2.pwn(115) : error 017: undefined symbol "GetPlayerskin"
D:\GTA San Andreas\PlanetS\pawno\test2.pwn(341) : error 017: undefined symbol "sscanf"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Did I really Need sscanf? so ye i will be install it, but why the GetPlayerSkin errors?
Reply
#8

First error:
PHP код:
GetPlayerSkin not GetPlayerskin
Second Error:
At the top of the script do:
PHP код:
#include <sscanf2> 
Reply
#9

pawn Код:
CMD:saveskin(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 1 && PlayerInfo[playerid][LoggedIn] == 1) {
        if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /saveskin [skinid]");
        new string[128], SkinID = strval(params);
        if((SkinID == 0)||(SkinID == 7)||(SkinID >= 9 && SkinID <= 41)||(SkinID >= 43 && SkinID <= 64)||(SkinID >= 66 && SkinID <= 73)||(SkinID >= 75 && SkinID <= 85)||(SkinID >= 87 && SkinID <= 118)||(SkinID >= 120 && SkinID <= 148)||(SkinID >= 150 && SkinID <= 207)||(SkinID >= 209 && SkinID <= 264)||(SkinID >= 274 && SkinID <= 288)||(SkinID >= 290 && SkinID <= 299))
        {
            dUserSetINT(PlayerName2(playerid)).("FavSkin",SkinID);
            format(string, sizeof(string), "You have successfully saved this skin (ID %d)",SkinID);
            SendClientMessage(playerid,yellow,string);
            SendClientMessage(playerid,yellow,"Type: /useskin to use this skin when you spawn or /dontuseskin to stop using skin");
            dUserSetINT(PlayerName2(playerid)).("UseSkin",1);
            return CMDMessageToAdmins(playerid,"SAVESKIN");
        } else return SendClientMessage(playerid, green, "ERROR: Invalid Skin ID");
    } else return SendClientMessage(playerid,red,"ERROR: You must be an administrator to use this command");
}

CMD:useskin(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 1 && PlayerInfo[playerid][LoggedIn] == 1) {
        dUserSetINT(PlayerName2(playerid)).("UseSkin",1);
        SetPlayerSkin(playerid,dUserINT(PlayerName2(playerid)).("FavSkin"));
        return SendClientMessage(playerid,yellow,"Skin now in use");
    } else return SendClientMessage(playerid,red,"ERROR: You must be an administrator to use this command");
}

CMD:dontuseskin(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 1 && PlayerInfo[playerid][LoggedIn] == 1) {
        dUserSetINT(PlayerName2(playerid)).("UseSkin",0);
        return SendClientMessage(playerid,yellow,"Skin will no longer be used");
    } else return SendClientMessage(playerid,red,"ERROR: You must be an administrator to use this command");
}
i took them from admin system xD
Reply
#10

Ahh oke thank all,
It give now 0 errors,
But what to do with the OnPlayerConnect and OnPlayerDissconnect?
I know only what supposed to do it with Dini..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)