Help players set vip
#1

hey , i have a problem, whene a player connect in server , it set him vip , so it must be vip=0 not more , and sometimes it set them vip=0(it work correctly here)
the Public ondialog:
pawn Код:
if(IsPlayerConnected(playerid)) {
        if(dialogid == REGISTER) {
            if(response == 1) {
                OnPlayerRegister(playerid, inputtext);
            }
        }
        if(dialogid == LOGIN) {
            if(response == 1) {
                new Password[25];
                strmid(Password, inputtext, 0, strlen(inputtext), 25);
                OnPlayerLogin(playerid, Password);
            }
        }
    }
Public onplayerregister:
pawn Код:
public OnPlayerRegister(playerid, Password[])
{
    if(IsPlayerConnected(playerid)) {
        if(strlen(Password) == 0) return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, "{00CCFF}Registration", "{FFFFFF}Please enter password for registration \n\n\n{FF0000}Registration is required", "Register", "");
        dini_Create(file[playerid]);
        dini_Set(file[playerid], "Password", Password);
        IsLogged[playerid] = true;
        SendClientMessage(playerid, COLOR_MODRA, " *You've successfully registered an account !");
    }
    return 1;
}
u can see that i didn't give a value for the Vip[playerid] i hope you make it..
Reply
#2

pawn Код:
public OnPlayerConnect( playerid )
{
    your_vip_variable_name = 0;
    // Reset the variables you are using on the Player Data.
    return 1;
}
When a player login, then set the variable to the value is been saved.
Reply
#3

ok but your code will set to each player connected vip=0 but if i maked a vip player , so he will be 0 ?
NB: i'm not using enums but Variables like [PAWN] new Vip[MAX_PLAYERS]
Reply
#4

well do that then
use this in on player register.
pawn Код:
Vip[playerid] = 0
then you are setting them to 0 when they signup,

now to read it when they login

you need to learn how to read with dini_
although i recommend yini you can use what you have

then when your comparing the pass in OnPlayerLogin

pawn Код:
Vip[playerid] = dini_Read(vip);
note i dont use dini so the code above will not work just an example
Reply
#5

I said set it to 0 OnPlayerConnect Callback and after login, read the file and set them their vip level.
Reply
#6

oh i see , i have also the AdminLevel Variable , so i do the same thing with it ?
@Dwayne : o sorry i didn't understand your first post
Reply
#7

yes!!

and like dwayne make sure you reset them to 0 on connect
so a new user with the same id as the last wont have the same rights!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)