how to save skin? with UserINT?READ plz help
#1

hey i am trying to save player skin so when the come back the have the skin the had last but i dont know how do it with this system here is some code that helps understand what i mean

this when i do /savestats
PHP код:
dUserSetINT(PlayerName(i)).("Score"GetPlayerScore(i)); 
this when players first register
PHP код:
if(udb_Create(PlayerName(playerid),inputtext))
            {
                
SendClientMessage(playeridCOLOR_LIGHTBLUE"You have registerd. Your stats will save when you leave the game.");
                
LogPlayer(playerid);
                
PLAYERLIST_authed[playerid] = true;
                
dUserSetINT(PlayerName(playerid)).("Score"0);
                
dUserSetINT(PlayerName(playerid)).("Cash"1500);
                
dUserSetINT(PlayerName(playerid)).("BankCash"5000);
                
dUserSetINT(PlayerName(playerid)).("AdminLevel"0);
                
dUserSetINT(PlayerName(playerid)).("Banned"0);
                
dUserSetINT(PlayerName(playerid)).("WantedLevel"0);
                
dUserSetINT(PlayerName(playerid)).("Warnings"0);
                
dUserSetINT(PlayerName(playerid)).("PackCash"0);
                
dUserSetINT(PlayerName(playerid)).("ArmyPermission"0);
                
dUserSetINT(PlayerName(playerid)).("PackPot"0);
                
dUserSetINT(PlayerName(playerid)).("PackPipe"0);
                
dUserSetINT(PlayerName(playerid)).("PackCondom"0);
                
dUserSetINT(PlayerName(playerid)).("PackSnack"0);
                
dUserSetINT(PlayerName(playerid)).("PackWallet"0);
                
dUserSetINT(PlayerName(playerid)).("PackExp"0);
                
dUserSetINT(PlayerName(playerid)).("HasPack"0);
                
dUserSetINT(PlayerName(playerid)).("RobSkill"0);
                
dUserSetINT(PlayerName(playerid)).("TerrorSkill"0);
                new 
pIP[16]; GetPlayerIp(playeridpIP16);
                
dUserSet(PlayerName(playerid)).("IP"pIP);
            }
            return 
true;
        }
        return 
1;
    }
//End of Register Dialog 
and this when player logged in

PHP код:
    if(udb_CheckLogin(PlayerName(playerid),inputtext))
            {
                
SetPVarInt(playerid"AdminLevel"dUserINT(PlayerName(playerid)).("AdminLevel"));
                
SetPVarInt(playerid"Banned"dUserINT(PlayerName(playerid)).("Banned"));
                
SetPVarInt(playerid"BankCash"dUserINT(PlayerName(playerid)).("BankCash"));
                
SetPVarInt(playerid"Cash"dUserINT(PlayerName(playerid)).("Cash"));
                
SetPVarInt(playerid"WantedLevel"dUserINT(PlayerName(playerid)).("WantedLevel"));
                
SetPVarInt(playerid"HasPack"dUserINT(PlayerName(playerid)).("HasPack"));
                
SetPVarInt(playerid"Warnings"dUserINT(PlayerName(playerid)).("Warnings"));
                
SetPVarInt(playerid"PackCash"dUserINT(PlayerName(playerid)).("PackCash"));
                
SetPVarInt(playerid"ArmyPermission"dUserINT(PlayerName(playerid)).("ArmyPermission"));
                
SetPVarInt(playerid"PackPipe"dUserINT(PlayerName(playerid)).("PackPipe"));
                
SetPVarInt(playerid"PackWallet"dUserINT(PlayerName(playerid)).("PackWallet"));
                
SetPVarInt(playerid"PackCondom"dUserINT(PlayerName(playerid)).("PackCondom"));
                
SetPVarInt(playerid"PackExp"dUserINT(PlayerName(playerid)).("PackExp"));
                
SetPVarInt(playerid"PackSnack"dUserINT(PlayerName(playerid)).("PackSnack"));
                
SetPVarInt(playerid"PackPot"dUserINT(PlayerName(playerid)).("PackPot"));
                
SetPVarInt(playerid"JailTime"dUserINT(PlayerName(playerid)).("JailTime"));
                
SetPVarInt(playerid"RobSkill"dUserINT(PlayerName(playerid)).("RobSkill"));
                
SetPVarInt(playerid"Elite"dUserINT(PlayerName(playerid)).("Elite"));
                
SetPVarInt(playerid"TerrorSkill"dUserINT(PlayerName(playerid)).("TerrorSkill"));
                
/*SetPVarInt(playerid, "HouseOnePerson", dUserINT(PlayerName(playerid)).("HouseOnePerson"));
                SetPVarInt(palyerid, "HouseTwoPerson", dUserINT(PlayerName(playerid)).("HouseTwoPerson"));
                SetPVarInt(playerid, "HouseThreePerson", dUserINT(PlayerName(playerid)).("HouseThreePerson"));
                SetPVarInt(playerid, "HouseFourPerson", dUserINT(PlayerName(playerid)).("HouseFourPerson"));
                SetPVarInt(playerid, "HouseFivePerson", dUserINT(PlayerName(playerid)).("HouseFivePerson"));
                SetPVarInt(playerid, "HouseSixPerson", dUserINT(PlayerName(playerid))."HouseSixPerson"));*/
                
SetPlayerScore(playeriddUserINT(PlayerName(playerid)).("Score"));
                
SetPlayerWantedLevel(playeridGetPVarInt(playerid"WantedLevel"));
                
GivePlayerMoney(playeridGetPVarInt(playerid"Cash"));
                new 
pIP[16]; GetPlayerIp(playeridpIP16);
                
dUserSet(PlayerName(playerid)).("IP"pIP);
                
PLAYERLIST_authed[playerid] = true;
                
SpawnPlayer(playerid);
                return 
SendClientMessage(playeridCOLOR_LIGHTBLUE"[INFO]: "COL_RWHITE"You are now logged in. Your stats will save when you leave the server.");
            }
            
LogPlayer(playerid);
        }
        return 
1;
    }
//End of Dialog 
i tryed dini y_ini and stuff but wont work what can i do please help
Reply
#2

Simply copy one of those integer loads/saves and like SetPlayerScore and GivePlayerMoney, you'd do SetPlayerSkin. I would put that part in OnPlayerSpawn though.
Reply
#3

Quote:
Originally Posted by coole210
Посмотреть сообщение
Simply copy one of those integer loads/saves and like SetPlayerScore and GivePlayerMoney, you'd do SetPlayerSkin. I would put that part in OnPlayerSpawn though.
so you mean like this
PHP код:
 SetPVarInt(playerid"Skin"dUserINT(PlayerName(playerid)).("Skin")); 
then OnPlayerSpawn
do this?
PHP код:
SetPlayerSkin(playeridGetPVarInt(playerid"Skin")); 
Reply
#4

Quote:
Originally Posted by UserName31
Посмотреть сообщение
so you mean like this
PHP код:
 SetPVarInt(playerid"Skin"dUserINT(PlayerName(playerid)).("Skin")); 
then OnPlayerSpawn
do this?
PHP код:
SetPlayerSkin(playeridGetPVarInt(playerid"Skin")); 
Try it, do that code and see if it works. PS: Use [ pawn ] [ / pawn ] tags when you are typing in the pawn language, easier to see the comments etc.

That should work. And then you could make a command of /setskin which saves the result as the PVar for the Skin if you know what I mean.
Reply
#5

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
Try it, do that code and see if it works. PS: Use [ pawn ] [ / pawn ] tags when you are typing in the pawn language, easier to see the comments etc.

That should work. And then you could make a command of /setskin which saves the result as the PVar for the Skin if you know what I mean.
it dint work man i have a command /skin ill give me the skin 124 then i save stats and quite and join back but wont save it keep setting skin to 0 cj
Reply
#6

Quote:
Originally Posted by UserName31
Посмотреть сообщение
it dint work man i have a command /skin ill give me the skin 124 then i save stats and quite and join back but wont save it keep setting skin to 0 cj
Try and add this to /skin:

pawn Код:
dUserSetINT(PlayerName(playerid)).("Skin", /*your result here, the one that is given from the second parameter of SetPlayerSkin*/);
And try and add this to /savestats:

pawn Код:
dUserSetINT(PlayerName(i)).("Skin",GetPlayerSkin(i));
Just an idea..
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)