OnPlayerSpawn SetSkin [reps+ urgrent]
#1

Hi i want that when a player spawn if his skin is saved , to set the playerid the skin

iv this cmd
INI_WriteInt(ACCOUNT, "Skin", skinid); == Saved ID I want to load this under onplayerspawn
Код:
CMD:myskin(playerid,params[])
{
	if(pInfo[playerid][pLevel] >= 0)
	{
        new skinid,Jfile[100];
	    if(sscanf(params, "i", skinid)) return
		SendClientMessage(playerid, yellow, "Usage: /Myskin <skin ID>") ;
		if(skinid < 0 || skinid > 299) return SendClientMessage(playerid, red, "Invaild Skin ID!");
		format(Jstring,sizeof(Jstring),"You have set skin '%d' as your favorite skin!", skinid);
		SendClientMessage(playerid,yellow,Jstring);
		format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid));
		new INI:ACCOUNT = INI_Open(Jfile);
		INI_WriteInt(ACCOUNT, "Skin", skinid);
		INI_Close(ACCOUNT);
		pInfo[playerid][Skin] = skinid;
		SetPVarInt(playerid,"Useskin",1);
		CommandToAdmins(playerid,"myskin");
		return SetPlayerSkin(playerid, skinid);
	}
	else return ShowMessage(playerid, red, 1);
}
Reply
#2

It is possible but few changes have to be made
You have to add this line When ur player registers and his all info is wriiten
pawn Код:
INI_WriteInt(ACCOUNT, "Skin", skinid);//here instead of skinid  write the default id which a player gets when he hasnt saved his skin
and when all data of Player is loaded like his pass cash score ....etc load skin also with it
Lets say that you have loaded skin id in variable pInfo[playerid][Skin]
then add this line on ur OnPlayerSpawn
pawn Код:
SetPlayerSkin(playerid, pInfo[playerid][Skin]);
Reply
#3

Put this OnPlayerSpawn
pawn Код:
new INI:ACCOUNT = INI_Open(Jfile);
        pInfo[playerid][pSkin] = INI_Int(ACCOUNT, "Skin", skinid);
        INI_Close(ACCOUNT);
Reply
#4

Код:
C:\Users\MaHdy\Desktop\SPA Orginal Build 2\filterscripts\JLadmin.pwn(697) : error 017: undefined symbol "Jfile"
C:\Users\MaHdy\Desktop\SPA Orginal Build 2\filterscripts\JLadmin.pwn(698) : warning 217: loose indentation
C:\Users\MaHdy\Desktop\SPA Orginal Build 2\filterscripts\JLadmin.pwn(698) : error 017: undefined symbol "pSkin"
C:\Users\MaHdy\Desktop\SPA Orginal Build 2\filterscripts\JLadmin.pwn(698) : error 029: invalid expression, assumed zero
C:\Users\MaHdy\Desktop\SPA Orginal Build 2\filterscripts\JLadmin.pwn(698) : error 035: argument type mismatch (argument 1)
C:\Users\MaHdy\Desktop\SPA Orginal Build 2\filterscripts\JLadmin.pwn(698) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#5

put this on the top of your script:

new pSkin;
new Jfile;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)