#1

Guys the register system was working good but i added other things after it when i register with another name it show me the register dialog and add my file in the scriptfile but it add the other name info like: skin, money, etc......
Please Help !!
Reply
#2

what it doesnt add?
Reply
#3

No it add all thing but it give the info of the last name joined
so score = 1000
and the default 0
admin = 100
and the default = 0
it give the last player info ?!
Reply
#4

show us the code !
Reply
#5

PHP код:
enum pInfo
{
    
pPass,
    
pCash,
    
pAdmin,
    
pKills,
    
pDeaths,
    
pSkin,
    
pBan,
    
pScore,
    
pPolice,
    
pGender
}
new 
PlayerInfo[MAX_PLAYERS][pInfo]; 
PHP код:
forward LoadUser_data(playerid,name[],value[]);
public 
LoadUser_data(playerid,name[],value[])
{
    
INI_Int("Password",PlayerInfo[playerid][pPass]);
    
INI_Int("Cash",PlayerInfo[playerid][pCash]);
    
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    
INI_Int("Kills",PlayerInfo[playerid][pKills]);
    
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
    
INI_Int("Ban",PlayerInfo[playerid][pBan]);
    
INI_Int("Score",PlayerInfo[playerid][pScore]);
    
INI_Int("Police",PlayerInfo[playerid][pPolice]);
    
INI_Int("Gender",PlayerInfo[playerid][pGender]);
    
    
return 
1;

PHP код:
stock UserPath(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),PATH,playername);
    return 
string;

PHP код:
stock udb_hash(buf[]) {
    new 
length=strlen(buf);
    new 
s1 1;
    new 
s2 0;
    new 
n;
    for (
n=0n<lengthn++)
    {
       
s1 = (s1 buf[n]) % 65521;
       
s2 = (s2 s1)     % 65521;
    }
    return (
s2 << 16) + s1;

PHP код:
public OnPlayerConnect(playerid)
{
if(
PlayerInfo[playerid][pBan] != 0)
{
SendClientMessage(playeridCOLOR_BLUE"You are banned from the server");
SendClientMessage(playeridCOLOR_BLUE"Try to contact one from our admins");
SetTimerEx("KickDelay"3000false"i"playerid);
}
else
{
new 
name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
GetPlayerName(playeridnamesizeof(name));
format(stringsizeof(string), "%s has joined the server."name);
SendClientMessageToAll(COLOR_GRAYstring);
   if(
fexist(UserPath(playerid)))
    {
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT,""COL_WHITE"Register",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
}
SetPlayerScore(playeridPlayerInfo[playerid][pScore]);
 
    return 
1;

PHP код:
public OnPlayerDisconnect(playeridreason)
{
            new 
INI:File INI_Open(UserPath(playerid));
            
INI_SetTag(File,"data");
            
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
            
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
            
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
            
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
            
INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
            
INI_WriteInt(File,"Ban",PlayerInfo[playerid][pBan]);
            
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
            
INI_WriteInt(File,"Police",PlayerInfo[playerid][pPolice]);
            
INI_WriteInt(File,"Gender",PlayerInfo[playerid][pGender]);
            
INI_Close(File);
    
    return 
1;

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if(!
response)
            {
            
Kick(playerid);
                if(
fexist(UserPath(playerid)))
                {
                    
fremove(UserPath(playerid));
                }
            }
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT,""COL_WHITE"Register",COL_RED"Invalid Password","Register","Close");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",10000);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_WriteInt(File,"Skin",0);
                
INI_WriteInt(File,"Ban",0);
                
INI_WriteInt(File,"Score",0);
                
INI_WriteInt(File,"Police",0);
                
INI_WriteInt(File,"Gender",0);
                
INI_Close(File);
                
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"Success",""COL_GREEN"You have registerd successfully","Start","");
                
                
            }
        }
        case 
DIALOG_LOGIN:
        {
            if(!
response) return Kick(playerid);
            if(
response)
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,""COL_WHITE"Success",""COL_GREEN"You have logged in successfully","Start","");
                    
                    
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",COL_RED"Invalid Paswword","Login","Close");
                }
            }
        }
        case 
DIALOG_GENDER:
        {
            if(!
response)
            {
            
Kick(playerid);
                if(
fexist(UserPath(playerid)))
                {
                    
fremove(UserPath(playerid));
                }
            }
            if(
response)
            {
            new 
randommale maleSkins[random(sizeof(maleSkins))];
            new 
randomfemale femaleSkins[random(sizeof(femaleSkins))];
               switch(
listitem)
               {
                  case 
0:
                  {
                    
SetSpawnInfo(playerid001958.331343.1215.36269.15000000);
                    
SetPlayerSkin(playeridrandommale);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"Success",""COL_GREEN"You have registered successfully","Start","");
                    
GivePlayerMoney(playerid10000);
                    
PlayerInfo[playerid][pGender] = 1;
                  }
                  case 
1:
                  {
                   
SetSpawnInfo(playerid001958.331343.1215.36269.15000000);
                    
SetPlayerSkin(playeridrandomfemale);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"Success",""COL_GREEN"You have registered successfully","Start","");
                    
GivePlayerMoney(playerid10000);
                    
PlayerInfo[playerid][pGender] = 2;
                  }
                }
             }
            }
    }
    return 
1;

PHP код:
CMD:mpolice(playeridparams[])
{
new 
targetid;
new 
level;
new 
malepoliceskin policeskin[random(sizeof(policeskin))];
if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_RED"This player is not connected");
if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCOLOR_RED"You can't use this command");
if(
sscanf(params,"ui"targetidlevel)) return SendClientMessage(playeridCOLOR_WHITE,"Usage: /mpolice [id] [Level]");
PlayerInfo[playerid][pPolice] = level;
if(
PlayerInfo[targetid][pGender] = 1)
{
SetPlayerSkin(targetidmalepoliceskin);
}
else
{
SetPlayerSkin(targetid93);
}
new 
name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
GetPlayerName(playeridnamesizeof(name));
format(stringsizeof(string), "%s's police level has changed"name);
SendClientMessageToAll(COLOR_GREENstring);
return 
1;

Reply
#6

try to make admins like this

pawn Код:
Admin[playerid][pAdmin] += value
Reply
#7

Which one ??
Reply
#8

on every command like setadmin and more stuff you saving...
Reply
#9

Give me example on mpolice
Reply
#10

nope this command is right but try to change the ui to i sometimes that help (help to me sometimes )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)