SA-MP Forums Archive
It keeps duplicating! - 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: It keeps duplicating! (/showthread.php?tid=337039)



It keeps duplicating! - Elysian` - 24.04.2012

Hello,
I have this under the OnPlayerConnect callback..
Код:
   else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Registering...","Type your password below to register a new account.","Register","Quit");
    }
    PlayerInfo[playerid][pAdminLevel] = 0;
	PlayerInfo[playerid][pDeaths] = 0;
	GivePlayerMoney(playerid, 2500);
	PlayerInfo[playerid][pBanned] = 0;
	PlayerInfo[playerid][pScore] = 0;
	PlayerInfo[playerid][pKills] = 0;
	PlayerInfo[playerid][Team] = -1;
But it keeps duplicating the money and I can't sort it out!


Re: It keeps duplicating! - Elysian` - 24.04.2012

Does anyone have a solution?


Re: It keeps duplicating! - Elysian` - 25.04.2012

No solution yet.


Re: It keeps duplicating! - nickdodd25 - 25.04.2012

Quote:
Originally Posted by Windows32
Посмотреть сообщение
Hello,
I have this under the OnPlayerConnect callback..
Код:
   else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Registering...","Type your password below to register a new account.","Register","Quit");
    }
    PlayerInfo[playerid][pAdminLevel] = 0;
	PlayerInfo[playerid][pDeaths] = 0;
	GivePlayerMoney(playerid, 2500);
	PlayerInfo[playerid][pBanned] = 0;
	PlayerInfo[playerid][pScore] = 0;
	PlayerInfo[playerid][pKills] = 0;
	PlayerInfo[playerid][Team] = -1;
But it keeps duplicating the money and I can't sort it out!
So your trying to make a new playerfile with that? If you are you need to put that under dialog responce and had it save them to a file then reloaded to your player array. heres all mine under my register response
pawn Код:
new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Online",1);
                INI_WriteInt(File,"Banned",0);
                INI_WriteInt(File,"Bans",0);
                INI_WriteInt(File,"Vip",0);
That is how i write a new player file then i reopen it to the player array and it works great. I am using y_ini for file saving.
This is the tut i used to make my system. https://sampforum.blast.hk/showthread.php?tid=273088


Re: It keeps duplicating! - MadeMan - 25.04.2012

What you mean "duplicating" ? Player gets $5000? Are you sure there is no GivePlayerMoney somewhere else?


Re: It keeps duplicating! - Elysian` - 25.04.2012

@Mademan,
No there is not, GivePlayerMoney is only called under OnPlayerConnect!

Here is my OnPlayerConnect callback!:
pawn Код:
{
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","Type your password below to login.","Login","Quit");
        ForceClassSelection(playerid);
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Registering...","Type your password below to register a new account.","Register","Quit");
    }
    PlayerInfo[playerid][pAdminLevel] = 0;
    PlayerInfo[playerid][pDeaths] = 0;
    GivePlayerMoney(playerid, 2500);
    PlayerInfo[playerid][pBanned] = 0;
    PlayerInfo[playerid][pScore] = 0;
    PlayerInfo[playerid][pKills] = 0;
    PlayerInfo[playerid][Team] = -1;
   
            new name[24];
        GetPlayerName(playerid, name, sizeof name);
        new string[128];



Re: It keeps duplicating! - ReneG - 25.04.2012

OnPlayerSpawn perhaps?