Help with register system
#1

OMG this register system i made it right, and then if i set player A to be an admin it will set and it will save, good.. Now if player B comes online and register he will get the stats of player A, resulting in him also being admin, anyways i then made a resetvariable(playerid);, which is called when the players (dis)connect, now i place this coding under the resetvariable function
PHP код:
pInfo[playerid][Admin] = 0
Which should reset the function for the player which also works, now when player A reconnects he doesn't have the admin status because of the function i have created. It will set the players admin level to 0 resulting he/she not being a server admin anymore...

PHP код:
ResetVariables(playerid)
{
    
PlayerTemp[playerid][OnDuty]   = 0;
    
PlayerTemp[playerid][OnhDuty]  = 0;
    
PlayerTemp[playerid][Spawned]  = 0;
    
PlayerTemp[playerid][isevent]  = 0;
    
PlayerTemp[playerid][MaxRcon]  = 0;
    
PlayerTemp[playerid][Jetpack]  = 0;
    
PlayerTemp[playerid][LastShot] = 0;
    
PlayerTemp[playerid][LastShotTick]  = 0;
       
PlayerTemp[playerid][dSpawnedCars]  = 0;
    
PlayerTemp[playerid][pSpawnFreeze]  = 0;
    
PlayerTemp[playerid][LoginAttempts] = 0;
//these are all that reset to 0 below
    
pInfo[playerid][Score]      = 0;
    
pInfo[playerid][Kills]      = 0;
    
pInfo[playerid][Deaths]      = 0;
    
pInfo[playerid][Banned]      = 0;
    
pInfo[playerid][Admin]      = 0;
/*^^^^^^^^^^^^^^^^^^^^^^^^^*/
    
NeedsHelp[playerid]            = 0;
    
ReportTime[playerid]           = 0;
    
Delete3DTextLabel(afklabel[playerid]);
    
Delete3DTextLabel(adminlabel[playerid]);
  

I have even seen the same pinfo[][] =0; in other admin systems and it doesn't result in what im getting
Reply
#2

I've had this problem too, and i fixed it by adding all player variables to 0; under OnPlayerConnect when he registeres. Hope this helps.

Here's the example from my script.:

PHP код:
else
    {
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
        
GivePlayerMoney(playerid25000);
        
PlayerInfo[playerid][pKills] = 0;
        
PlayerInfo[playerid][pDeaths] = 0;
        
PlayerInfo[playerid][pScore] = 0
Reply
#3

Where do you use ResetVariables()?
Reply
#4

add me in skype gta.abaddon.gta and i will help you
Reply
#5

Quote:
Originally Posted by 1fret
Посмотреть сообщение
OMG this register system i made it right, and then if i set player A to be an admin it will set and it will save, good.. Now if player B comes online and register he will get the stats of player A, resulting in him also being admin, anyways i then made a resetvariable(playerid);, which is called when the players (dis)connect, now i place this coding under the resetvariable function
PHP код:
pInfo[playerid][Admin] = 0
Which should reset the function for the player which also works, now when player A reconnects he doesn't have the admin status because of the function i have created. It will set the players admin level to 0 resulting he/she not being a server admin anymore...

PHP код:
ResetVariables(playerid)
{
    
PlayerTemp[playerid][OnDuty]   = 0;
    
PlayerTemp[playerid][OnhDuty]  = 0;
    
PlayerTemp[playerid][Spawned]  = 0;
    
PlayerTemp[playerid][isevent]  = 0;
    
PlayerTemp[playerid][MaxRcon]  = 0;
    
PlayerTemp[playerid][Jetpack]  = 0;
    
PlayerTemp[playerid][LastShot] = 0;
    
PlayerTemp[playerid][LastShotTick]  = 0;
       
PlayerTemp[playerid][dSpawnedCars]  = 0;
    
PlayerTemp[playerid][pSpawnFreeze]  = 0;
    
PlayerTemp[playerid][LoginAttempts] = 0;
//these are all that reset to 0 below
    
pInfo[playerid][Score]      = 0;
    
pInfo[playerid][Kills]      = 0;
    
pInfo[playerid][Deaths]      = 0;
    
pInfo[playerid][Banned]      = 0;
    
pInfo[playerid][Admin]      = 0;
/*^^^^^^^^^^^^^^^^^^^^^^^^^*/
    
NeedsHelp[playerid]            = 0;
    
ReportTime[playerid]           = 0;
    
Delete3DTextLabel(afklabel[playerid]);
    
Delete3DTextLabel(adminlabel[playerid]);
  

I have even seen the same pinfo[][] =0; in other admin systems and it doesn't result in what im getting
Make sure you aren't resetting the variables before saving his/her data on OnPlayerDisconnect.
Reply
#6

You should be resetting the value for that playerid on connect, and before login.
so when they login it gets their info
And if they're registering, you should be SETTING everything to default anyway..
So
Код:
 OnRegister(playerid) {  
    pInfo[playerid][Score]      = 0; 
    pInfo[playerid][Kills]      = 0; 
    pInfo[playerid][Deaths]      = 0; 
    pInfo[playerid][Banned]      = 0; 
    pInfo[playerid][Admin]      = 0; 
}
Reply
#7

PHP код:
ResetVariables(playerid)
{
    
PlayerTemp[playerid][OnDuty]   = 0;
    
PlayerTemp[playerid][OnhDuty]  = 0;
    
PlayerTemp[playerid][Spawned]  = 0;
    
PlayerTemp[playerid][isevent]  = 0;
    
PlayerTemp[playerid][MaxRcon]  = 0;
    
PlayerTemp[playerid][Jetpack]  = 0;
    
PlayerTemp[playerid][LastShot] = 0;
    
PlayerTemp[playerid][LastShotTick]  = 0;
       
PlayerTemp[playerid][dSpawnedCars]  = 0;
    
PlayerTemp[playerid][pSpawnFreeze]  = 0;
    
PlayerTemp[playerid][LoginAttempts] = 0;
//these are all that reset to 0 below
    
pInfo[playerid][Score]      = 0;
    
pInfo[playerid][Kills]      = 0;
    
pInfo[playerid][Deaths]      = 0;
    
pInfo[playerid][Banned]      = 0;
    
pInfo[playerid][Admin]      = 0;
/*^^^^^^^^^^^^^^^^^^^^^^^^^*/
    
NeedsHelp[playerid]            = 0;
    
ReportTime[playerid]           = 0;
    
Delete3DTextLabel(afklabel[playerid]);
    
Delete3DTextLabel(adminlabel[playerid]);
  

And no need for that, you can do a simple 1 line.
PHP код:
ResetVariables(playerid)
{
   
memcpy(pInfo[playerid], pInfo[MAX_PLAYERS], 0sizeof(pInfo[])*4sizeof(pInfo[]));  
memcpy(PlayerTemp[playerid], PlayerTemp[MAX_PLAYERS], 0sizeof(PlayerTemp[])*4sizeof(PlayerTemp[]));
    
NeedsHelp[playerid]  = 0;
    
ReportTime[playerid] = 0;
    
Delete3DTextLabel(afklabel[playerid]);
    
Delete3DTextLabel(adminlabel[playerid]);

Reply
#8

Not the TS but working on a similar system: is resetting these stats absolutely needed? Why can't the '[playerinfo][][admin]' integer be null instead of 0?

I don't question your knowledge on this subject, I am just curious.
Reply
#9

Quote:
Originally Posted by Mado
Посмотреть сообщение
Not the TS but working on a similar system: is resetting these stats absolutely needed? Why can't the '[playerinfo][][admin]' integer be null instead of 0?

I don't question your knowledge on this subject, I am just curious.
Resetting the stats is needed.
Suppose, you're ID 0 and you've data in your variables, and you leave the server, your variables aren't reset to zero and another new player joins with ID 0 ( which was same as yours ), so he'll get the same data as yours which aren't saved/loaded.
Reply
#10

Quote:
Originally Posted by Sunehildeep
Посмотреть сообщение
Resetting the stats is needed.
Suppose, you're ID 0 and you've data in your variables, and you leave the server, your variables aren't reset to zero and another new player joins with ID 0 ( which was same as yours ), so he'll get the same data as yours which aren't saved/loaded.
Got it. So I have to reset the variables every time a player joins and leaves the server?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)