Help please
#4

this my script now without agedialog, genderdialog :
PHP код:
#include <a_samp>
#include <a_mysql>
#include <zcmd>
#include <foreach>
#include "../include/gl_spawns.inc"
#include "../include/gl_common.inc"
#include <float>
#include <core>
#include <sscanf2>
#include <streamer>
#define    MYSQL_HOST        "localhost"
#define    MYSQL_USER        "root"
#define    MYSQL_DATABASE    "myserver"
#define    MYSQL_PASSWORD    ""
#define    SPAWN_X  1685.6680
#define    SPAWN_Y  -2332.9236
#define    SPAWN_Z  13.5469
#define    SPAWN_A  2.3834
#define COLOR_WHITE         0xFFFFFFFF
#define GAMETEXT_COLOR 1
enum
{
    
LoginDialog,
    
RegisterDialog,
    
AgeDialog,
    
GenderDialog,
    
EmailDialog
};
new
    
mysql;
    
native WP_Hash(buffer[], len, const str[]);
    
enum PlayerData
{
    
ID,
    
Name[MAX_PLAYER_NAME],
    
Password[129],
    
IP[16],
    
Admin,
    
VIP,
    
Money,
    
Float:posX,
    
Float:posY,
    
Float:posZ,
    
Float:posA
};
new 
Player[MAX_PLAYERS][PlayerData];
public 
OnGameModeInit()
{
    
AddPlayerClass(0,1685.6680,-2332.9236,13.5469,2.3834,0,0,0,0,0,0);
     
mysql_log(LOG_ALL);
    
mysql mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_DATABASEMYSQL_PASSWORD);
    if(
mysql_errno() != 0)
    {
        
printf("[MySQL] The connection has failed.");
    }
    else
    {
        
printf("[MySQL] The connection was successful.");
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
   
SetPlayerColor(playeridCOLOR_WHITE);
   
SendClientMessage(playerid,COLOR_WHITE,"{FFFFFF}Welcome to {0000CD}Indonesia Real Life Roleplay");
     
SendClientMessage(playerid,COLOR_WHITE,"{FFFFFF}Visit {00FF00}www.new.IRL-RP.com {FFFFFF}to register new character!");
    new
        
query[128],
        
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    
mysql_format(mysqlquerysizeof(query), "SELECT `Password`, `ID` FROM `accounts` WHERE `Name` = '%e' LIMIT 1"playername);
    
mysql_tquery(mysqlquery"OnAccountCheck""i"playerid);
    return 
true;
}
forward OnAccountCheck(playerid);
public 
OnAccountCheck(playerid)
{
    
    new
        
rows,
        
fields,
        
name[MAX_PLAYER_NAME];
    
cache_get_data(rowsfieldsmysql);
     
GetPlayerName(playerid,name,sizeof(name));
    if(
rows)
    {
        new 
string1[400],string[400],ip[50];
        
GetPlayerIp(playeridipsizeof(ip));
        
cache_get_field_content(0"Password"Player[playerid][Password], mysql129);
        
Player[playerid][ID] = cache_get_field_content_int(0"ID");
        
format(string128"{FF0000}Indonesia Real Life Roleplay\n\n");
        
strcat(string1,string);
        
format(string128"{FFFFFF}Nama : {FF0000}%s\n{FFFFFF}IP : {FF0000}%s"nameip);
        
strcat(string1,string);
        
format(string128"\n\n{FFFFFF}Silahkan masukkan password anda untuk melakukan Log In pada server.\n");
        
strcat(string1,string);
        
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_INPUT,"{FF0000}Indonesia Real Life Roleplay - {FF0000}Login",string1,"Log-in","Quit");
    }
    else
    {
        new 
string1[400],string[400],ip[50];
        
GetPlayerIp(playeridipsizeof(ip));
         
format(string128"{FF0000}Indonesia Real Life Roleplay\n\n");
        
strcat(string1,string);
        
format(string128"{FFFFFF}Nama : {FF0000}%s\n{FFFFFF}IP : {FF0000}%s"nameip);
        
strcat(string1,string);
        
format(string128"\n\n{FFFFFF}Silahkan masukkan password anda untuk melakukan registrasi pada server ini.\n");
        
strcat(string1,string);
        
ShowPlayerDialog(playeridRegisterDialogDIALOG_STYLE_LIST,"{FF0000}Indonesia Real Life Roleplay - {FF0000}Register",string1,"Register","Quit");
    }
    return 
true;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new
        
query[128],
        
Float:pos[4];
    
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
    
GetPlayerFacingAngle(playeridpos[3]);
    
mysql_format(mysqlquerysizeof(query), "UPDATE `accounts` SET `Money` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosA` = %f WHERE `ID` = %d",
    
GetPlayerMoney(playerid), pos[0], pos[1], pos[2], pos[3], Player[playerid][ID]);
    
mysql_tquery(mysqlquery"""");
        
TextDrawHideForPlayer(playeridTime), TextDrawHideForPlayer(playeridDate), TextDrawHideForPlayer(playeridIRLRP);
    return 
true;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
                 switch(
dialogid)
    {
        case 
LoginDialog:
        {
            if(!
responseKick(playerid);
            new
                
hashpass[129],
                
query[100],
                
name[MAX_PLAYER_NAME],
                
playername[MAX_PLAYER_NAME];
            
GetPlayerName(playeridplayernamesizeof(playername));
            
GetPlayerName(playerid,name,sizeof(name));
            
WP_Hash(hashpasssizeof(hashpass), inputtext);
            if(!
strcmp(hashpassPlayer[playerid][Password]))
            {
                
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1"playername);
                
mysql_tquery(mysqlquery"OnAccountLoad""i"playerid);
            }
            else
            {
                new 
string1[400],string[400],ip[50];
                 
GetPlayerIp(playeridipsizeof(ip));
                
SendClientMessage(playerid, -1"You have specified an incorrect password!");
                
format(string128"{FF0000}Indonesia Real Life Roleplay\n\n");
                
strcat(string1,string);
                
format(string128"{FFFFFF}Nama : {FF0000}%s\n{FFFFFF}IP : {FF0000}%s"nameip);
                
strcat(string1,string);
                
format(string128"\n\n{FFFFFF}Silahkan masukkan password anda untuk melakukan Log In pada server.\n");
                
strcat(string1,string);
                
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_INPUT,"{FF0000}Indonesia Real Life Roleplay - {FF0000}Login",string1,"Log-in","Quit");
            }
        }
        case 
RegisterDialog:
        {
            if(!
response) return Kick(playerid);
            if(
strlen(inputtext) < 5)
            {
                
SendClientMessage(playerid, -1"Your password must at least contain more than 4 characters.");
                new 
string1[400],string[400],ip[50],name[MAX_PLAYER_NAME];
                
GetPlayerName(playerid,name,sizeof(name));
                
GetPlayerIp(playeridipsizeof(ip));
                 
format(string128"{FF0000}Indonesia Real Life Roleplay\n\n");
                
strcat(string1,string);
                
format(string128"{FFFFFF}Nama : {FF0000}%s\n{FFFFFF}IP : {FF0000}%s"nameip);
                
strcat(string1,string);
                
format(string128"\n\n{FFFFFF}Silahkan masukkan password anda untuk melakukan registrasi pada server ini.\n");
                 
strcat(string1,string);
                 return 
ShowPlayerDialog(playeridRegisterDialogDIALOG_STYLE_INPUT,"{FF0000}Indonesia Real Life Roleplay - {FF0000}Register",string1,"Register","Quit");
            }
            new
                
query[512],
                
playername[MAX_PLAYER_NAME],
                
playerip[16];
            
GetPlayerName(playeridplayernamesizeof(playername));
            
GetPlayerIp(playeridplayeripsizeof(playerip));
            
WP_Hash(Player[playerid][Password], 129inputtext);
            
mysql_format(mysqlquerysizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX`, `PosY`, `PosZ`, `PosA`) VALUES ('%e', '%e', '%e', 0, 0, 0, %f, %f, %f, %f)"playernamePlayer[playerid][Password], playeripSPAWN_XSPAWN_YSPAWN_ZSPAWN_A);
            
mysql_tquery(mysqlquery"OnAccountRegister""i"playerid);
        }
    }
    return 
false;
}
forward OnAccountLoad(playerid);
public 
OnAccountLoad(playerid)
{
   new 
name[MAX_PLAYER_NAME];
   new 
string[500];
   
GetPlayerName(playerid,name,sizeof(name));
    
Player[playerid][Admin] = cache_get_field_content_int(0"Admin");
    
Player[playerid][VIP] = cache_get_field_content_int(0"VIP");
    
Player[playerid][Money] = cache_get_field_content_int(0"Money");
    
Player[playerid][posX] = cache_get_field_content_float(0"PosX");
    
Player[playerid][posY] = cache_get_field_content_float(0"PosY");
    
Player[playerid][posZ] = cache_get_field_content_float(0"PosZ");
    
Player[playerid][posA] = cache_get_field_content_float(0"PosA");
    
GivePlayerMoney(playeridPlayer[playerid][Money]);
    
SetSpawnInfo(playerid061Player[playerid][posX], Player[playerid][posY], Player[playerid][posZ], Player[playerid][posA], 000000);
    
SpawnPlayer(playerid);
    
format(stringsizeof(string), "{0000CD}[SERVER] {FFFFFF}Welcome Back {00FF00}%s, {FFFFFF}you are now logged in."name);
    
SendClientMessage(playerid, -1string);
    return 
true;
}
forward OnAccountRegister(playerid);
public 
OnAccountRegister(playerid)
{
     new 
name[MAX_PLAYER_NAME];
   new 
string[500];
   
GetPlayerName(playerid,name,sizeof(name));
    
Player[playerid][ID] = cache_insert_id();
    
printf("[Registration] New account registered. Database ID: [%d]"Player[playerid][ID]);
    
SetSpawnInfo(playerid061SPAWN_XSPAWN_YSPAWN_ZSPAWN_A000000);
    
SpawnPlayer(playerid);
    
    
format(stringsizeof(string), "{0000CD}[SERVER] {FFFFFF}Welcome New Player {00FF00}%s, {FFFFFF}you are registered now."name);
    
SendClientMessage(playerid, -1string);
    return 
true;

How to add GenderDialog after create new password in RegisterDialog and add AgeDialog after select Gender in Gender Dialog??
Reply


Messages In This Thread
Help please - by Imbalo - 22.03.2017, 04:17
Re: Help please - by Ayyash - 22.03.2017, 06:19
Re: Help please - by GoldenLion - 22.03.2017, 13:12
Re: Help please - by Imbalo - 22.03.2017, 16:19
Re: Help please - by Sibuscus - 22.03.2017, 19:14
Re: Help please - by Sew_Sumi - 22.03.2017, 20:31
Re: Help please - by Imbalo - 23.03.2017, 03:58
Re: Help please - by Sew_Sumi - 23.03.2017, 05:24
Re: Help please - by Imbalo - 23.03.2017, 06:30
Re: Help please - by Sew_Sumi - 23.03.2017, 12:30

Forum Jump:


Users browsing this thread: 1 Guest(s)