SA-MP Forums Archive
Help players set vip - 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: Help players set vip (/showthread.php?tid=321625)



Help players set vip - ServerScripter - 27.02.2012

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..


Re: Help players set vip - Konstantinos - 27.02.2012

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.


Re: Help players set vip - ServerScripter - 28.02.2012

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]


Re: Help players set vip - Madd Kat - 28.02.2012

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


Re: Help players set vip - Konstantinos - 28.02.2012

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


Re: Help players set vip - ServerScripter - 28.02.2012

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


Re: Help players set vip - Madd Kat - 28.02.2012

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!