Skin load! how
#1

hello this is my skin cmd which saves player skin id
so onPlayerSpawn when you just join the server and spawn he will get which he save skin ?

pawn Код:
CMD:skin(playerid, params[]) // Creating the /skin command.
{
    new skinid,string[256];
    // If you want make this command only available for Rcon Admins, then remove // characters below this.
    //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You aren't allowed to use this command.");
    if(sscanf(params, "d", skinid)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /skin (skinid)"); // Player has used the command without params, then we send him a message.

    // Now the variable 'skinid' contains the value that player has gave as params.
    // Example /skin 294 and the variable contains now the value '294'

    if(skinid > 299 || skinid < 0) return SendClientMessage(playerid, 0xFF0000FF, "Invalid Skin ID!");

    // Now everything seems okay and we change his skin!
    SetPlayerSkin(playerid, skinid); // As you know the 'skinid' contains the value of player's given params.
    format(string,sizeof(string),"** You changed your skin to %d",skinid);
    SendClientMessage(playerid,-1,string);
    pInfo[playerid][Skin] = skinid;
    SavePlayerData(playerid);
    return 1; // Of course we need return a value.
    }
its y_ini saving system





Lock this topic
coz problem is fixed
Reply
#2

Yes he'll get it as the onplayerspawn's function will be loaded, a function which include your player pinfo i guess so.
If i'm wrong, be more specific please, what are you looking for?
Reply
#3

im looking that

if player spawn he get skin which he saved with /skin <id>
Reply
#4

Can you pm me or post here the following functions the SavePlayerData(playerid)'s and OnPlayerSpawn's function?
Reply
#5

You will have to store datas for that.

pawn Код:
enum PlayerInfo
{
    pSkin
}
new pInfo[MAX_PLAYERS][PlayerInfo];

forward loadaccount_user(playerid, name[], value[]);
public loadaccount_user(playerid, name[], value[])
{
    INI_Int("Skin", pInfo[playerid][pSkin]);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new INI:file = INI_Open(Path(playerid));
    INI_SetTag(file,"Player's Data");
    INI_WriteInt(file,"Skin",pInfo[playerid][pSkin]
    INI_Close(file);
    return 1;
}
Reply
#6

problem is fixed


everything was fine i just need to add this line
SetPlayerSkin(playerid,pInfo[playerid][Skin]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)