It keeps duplicating!
#1

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!
Reply
#2

Does anyone have a solution?
Reply
#3

No solution yet.
Reply
#4

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
Reply
#5

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

@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];
Reply
#7

OnPlayerSpawn perhaps?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)