13.03.2011, 09:35
in this script have with /register /login and save score and admin level.
we are dont know make simple admin system. like /jail /kick /ban
using ZCMD.
how yea? help me yea guys.
GAMEMODE CODE:
REGISTRATION SYSTEM CODE FOR PUT IN GAMEMODE:
AT TOP GM
the last:
END OF REGISTRATION COMMANDS
i just need to know how if player loged in then can use admin system make me one tutorial..
we are dont know make simple admin system. like /jail /kick /ban
using ZCMD.
how yea? help me yea guys.
GAMEMODE CODE:
pawn Код:
// what special? just simple use commands /help
//made from 14/3/2011
#include <a_samp>
#include <dini>
#include <dudb>
#include <zcmd>
#define COLOR_GOLD 0xB8860BAA
#define COLOR_BRIGHTRED 0xE60000FF
#define COLOR_BLUE 0x76c2ffff
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_PURPLE 0x9900FFAA
#define COLOR_BROWN 0x993300AA
#define COLOR_ORANGE 0xFF9933AA
#define COLOUR_PINK 0xFF00FFFF
#define COLOUR_PURPLE 0x800080FF
#define COLOUR_BLACK 0x000000FF
#define COLOR_CYAN 0x99FFFFAA
#define COLOR_TAN 0xFFFFCCAA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_KHAKI 0x999900AA
#define COLOR_LIME 0x99FF00AA
#define COLOR_BLACK 0x000000AA
#define COLOR_TURQ 0x00A3C0AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_DARKRED 0xAA993333
#define COLOR_VIOLET 0x9955DEEE
#define NICE_BLUE 0xa0d3ffAA
#define GREEN 0x21DD00FF
#define RED 0xE60000FF
#define ADMIN_RED 0xFB0000FF
#define YELLOW 0xFFFF00FF
#define ORANGE 0xF97804FF
#define LIGHTRED 0xFF8080FF
#define LIGHTBLUE 0x00C2ECFF
#define PURPLE 0xB360FDFF
#define PLAYER_COLOR 0xFFFFFFFF
#define BLUE 0x1229FAFF
#define LIGHTGREEN 0x38FF06FF
#define DARKPINK 0xE100E1FF
#define DARKGREEN 0x008040FF
#define ANNOUNCEMENT 0x00CACAFB
#define COLOR_SYSTEM 0xEFEFF7AA
#define NICESKY 0x99FFFFAA
#define GRAY 0xCECECEFF
#define red 0xE60000FF
#define yellow 0xFFFF00FF
enum pInfo
{
pAdminLevel,
pCash,
pScore,
pKill,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
#define SERVER_USER_FILE "UserAccount/%s.ini"
/*#define SettingFile "UserSetting/MainSettings.ini"
#define CommandFile "UserCommands/Commands.ini"*/
// this will create for u as u have already in scriptfile Make new folder with name: UserAccount
//when ingame u registered we will make Name.ini as .ini file
//new Text:Welcome;
//new gPlayerClass[MAX_PLAYERS];
//--------DEFINE DIALOG--------//
#define Dialog_Rules 0
//------END DEFINE DIALOG------//
//= - = - = - = - = - = - = - = DEFINES = - = - = - = - = - = - = - = - = - =//
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
new Pickup1;
new PickupHealth;
new Pickup2;
main()
{
print("\n-------------------------------");
print(" Dr.Ghost GAMEMODE DEATHMATCH v1.0");
print(" 14/03/2011 ");
print(" Loaded 1 GameMode ");
print("-------------------------------\n");
Pickup1 = CreatePickup(336, 2, 1170.62,2769.33,11.32, 0);//baseball
Pickup2 = CreatePickup(358, 2, 747.22, -1263.09, 13.56, 0);//sniper pickup
PickupHealth = CreatePickup(1240, 2, 1222.73, 2754.27, 11.35);
}
public OnGameModeInit()
{
SetGameModeText("DEATH MATCH v1.0 BETA");
AddPlayerClass(56, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(211, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(11, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(12, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(40, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(41, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(64, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(55, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(63, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(69, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(76, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(85, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(87, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(90, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(92, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(93, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(233, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(131, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(138, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(140, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(145, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(150, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(151, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(152, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(157, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(192, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(172, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(169, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(195, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(198, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(199, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(201, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(205, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(224, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(216, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(211, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(226, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(237, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(246, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(251, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(257, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(298, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
print("\n-------------------------------");
print(" Dr.Ghost GAMEMODE DEATHMATCH v1.0");
print(" 14/03/2011 ");
print(" (Un)Loaded 1 GameMode ");
print("-------------------------------\n");
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,2080.5840,1105.8773,10.8203);
SetPlayerFacingAngle(playerid, 89.5472);
SetPlayerCameraPos(playerid,2078.5840,1105.8773,10.8203);
SetPlayerCameraLookAt(playerid,2080.5840,1105.8773,10.8203);
return 1;
}
public OnPlayerConnect(playerid)
{
// /register & /login SYstem
gPlayerLogged[playerid] = 0;
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if (!dini_Exists(file))
{
SendClientMessage(playerid,COLOR_PINK,"{88AA18}Please Register Or Input The password");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{F6358A}Deathmatch Server Registered", "Input The password", "Register", "Leave");
}
if(fexist(file))
{
SendClientMessage(playerid,COLOR_PINK,"{88AA18}This Account Registered! Please Login To COntinue Or Input The password Below");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{F6358A}This Account Is Registered", "Input your password below", "Login", "Leave");
}
// END OF /register & /login SYstem
new string[128];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "Player %s Has Joined The Server.", pname);
SendClientMessageToAll(COLOR_PINK, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE,"Welcome To Official: DEATHMATCH GIRL v1.0 BETA!");
SendClientMessage(playerid, COLOR_PINK," Use Commands /help & /about for GEneral commands server");
SendClientMessage(playerid, COLOR_DARKRED,"Usage: /login & /register If You Not Yet Registered");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new string[56];
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "Player %s Has Left The Server.", plname);
SendClientMessageToAll(COLOR_PINK, string);
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
dini_IntSet(file, "Kill", PlayerInfo[playerid][pKill]);
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
//GetPlayerIp(playerid,ip,sizeof(ip));
//dini_IntSet(file,"IP",ip);
}
gPlayerLogged[playerid] = 0;
return 1;
}
public OnPlayerUpdate(playerid) {
if(GetPlayerWeapon(playerid) == 35)
{
SetPlayerHealth(playerid,0.0);
ResetPlayerWeapons(playerid);
SendClientMessageToAll(COLOR_RED,"HAS BEEN AUTOMATICCALLY KILLED BY SERVER FOR ROCKET");
SendClientMessage(playerid,COLOR_PINK,"YOU HAS BEEN KILLED BY SERVER FOR ROCKET");
}
if(GetPlayerWeapon(playerid) == 36)
{
SetPlayerHealth(playerid,0.0);
ResetPlayerWeapons(playerid);
SendClientMessageToAll(COLOR_RED,"HAS BEEN AUTOMATICCALLY KILLED BY SERVER FOR ROCKET");
SendClientMessage(playerid,COLOR_PINK,"YOU HAS BEEN KILLED BY SERVER FOR ROCKET");
}
if(GetPlayerWeapon(playerid) == 18)
{
SetPlayerHealth(playerid,0.0);
ResetPlayerWeapons(playerid);
SendClientMessageToAll(COLOR_RED,"HAS BEEN AUTOMATICCALLY KILLED BY SERVER FOR MOLOTOV");
}
if(GetPlayerWeapon(playerid) == 44)
{
Kick(playerid);
ResetPlayerWeapons(playerid);
SendClientMessageToAll(COLOR_RED,"HAS BEEN AUTOMATICCALLY KICKED BY SERVER FOR Nightvision Goggles");
SendClientMessage(playerid,COLOR_PINK,"YOU HAS BEEN AUTOMATICCALLY KICKED BY SERVER FOR Nightvision Goggles");
}
if(GetPlayerWeapon(playerid) == 45)
{
Kick(playerid);
ResetPlayerWeapons(playerid);
SendClientMessageToAll(COLOR_RED,"HAS BEEN AUTOMATICCALLY KICKED BY SERVER FOR Thermal Goggles");
SendClientMessage(playerid,COLOR_PINK,"YOU HAS BEEN AUTOMATICCALLY KICKED BY SERVER FOR Thermal Goggles");
}
if(GetPlayerWeapon(playerid) == 38) // minigun checked
{
Kick(playerid);
ResetPlayerWeapons(playerid);
SendClientMessageToAll(COLOR_RED,"HAS BEEN AUTOMATICCALLY KICKED BY SERVER FOR MINIGUN");
SendClientMessage(playerid,COLOR_PINK,"YOU HAS BEEN AUTOMATICCALLY KICKED BY SERVER FOR MINIGUN'S");
}
//End Of weapon cheked
if(GetPlayerSkin(playerid) == 0) //check who have CJ skin
{
SetPlayerSkin(playerid, 167);
GivePlayerMoney(playerid,-5000);
SendClientMessage(playerid, COLOR_RED, "You can't use CJs skin. Changing to another one. Press F4 if you want to select a new skin");
}
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid,0);
GivePlayerWeapon(playerid,26,908);//sawn off gun
GivePlayerWeapon(playerid,24,900);//desert eagle
GivePlayerWeapon(playerid,29,908);//mp5
GivePlayerWeapon(playerid,31,988);//m4
GivePlayerWeapon(playerid,33,988);//Country Rifle
GivePlayerWeapon(playerid,34,988);//sniper rifle
GivePlayerWeapon(playerid,43,988);//camera
new randd = random(4); //random spawn
switch (randd)
{
case 0:SetPlayerPos(playerid,1197.49,2768.81,10.82); //at golf club 1
case 1:SetPlayerPos(playerid,1278.66,2753.25,10.82); //at golf club 2
case 2:SetPlayerPos(playerid,1214.71,2742.96,10.83); //at golf club 3
case 3:SetPlayerPos(playerid,1236.29,2819.80,10.81); //at golf club 4
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SendClientMessageToAll(COLOR_RED, "One A Player Has Been Died RUN!!");
return 1;
}
// here are all cmds for ZCMD do not have OnPlayerCommandsText
/*command(kick, playerid, params[])
{
if(IsPlayerAdmin(playerid)) {
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5) {
return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /kick (id) [reason]");
}
new id = strval(tmp);
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : Bad player ID");
return 1;
}
gMessage = strrest(cmdtext,idx);
GetPlayerName(id,iName,sizeof(iName));
SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- You have been kicked from the server.");
if(strlen(gMessage) > 0) {
format(Message,sizeof(Message),"Reason: %s",gMessage);
SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message);
}
format(Message,sizeof(Message),">> %s(%d) has been kicked.",iName,id);
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message);
Kick(id);
return 1;
} else {
SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : You are not an admin");
return 1;
}
}*/
command(help, playerid, params[])
{
SendClientMessage(playerid,COLOR_PINK,"usage commands: /kill /buysawnoff");
return 1;
}
command(buysawnoff, playerid, params[])
{
SendClientMessage(playerid,0xAA3333AA, "Thank you for buying an Sawn OFf Gun's,Have fun with it");
SendClientMessage(playerid,COLOR_PINK,"AND PAID $3000");
GivePlayerMoney(playerid,-3000);
GivePlayerWeapon(playerid,26,470);
return 1;
}
command(kill, playerid, params[]) // command is command too
{
GameTextForPlayer(COLOR_GREEN, "~g~You Has ~r~Killing Yourself.~r~Stop Emotional!",4000,5);
SetPlayerHealth(playerid, 0);
return 1;
}
CMD:(kill, playerid, params[]) // CMD: is command too
{
GameTextForPlayer(COLOR_GREEN, "~g~You Has ~r~Killing Yourself.~r~Stop Emotional!",4000,5);
SetPlayerHealth(playerid, 0);
return 1;
}
//end of try
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 1)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{F6358A}Thia Account Not Registered", "Welcome, your not registered Yet, input your registration password below", "Register", "Leave");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
//dini_IntSet(file, "Pkill"PlayerInfo[playerid][Pkill] = 0);
format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
SendClientMessage(playerid, COLOR_PINK, string);
gPlayerLogged[playerid] = 1;
}
if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{F6358A}This Account registered", "Input your password below", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid, COLOR_RED, "Wrong PassWord sir.");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{F6358A}Your Account Registered", "Input your password below", "Login", "Leave");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: You Have Successfully logged in!");
}
}
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == Pickup1)//sniper pickups
{
GameTextForPlayer(playerid,"YOU BOUGHT A SNIPER",5000,5);
GivePlayerWeapon(playerid,34,8999);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
if(pickupid == Pickup2)//sniper pickups
{
GameTextForPlayer(playerid,"YOU BOUGHT A ~g~Baseball ~r~Bat",5000,5);
GivePlayerWeapon(playerid,5,1);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
if(pickupid == PickupHealth)
{
SetPlayerHealth(playerid,100);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
DestroyPickup(PickupHealth);
}
return 1;
}
AT TOP GM
Код:
enum pInfo { pAdminLevel, pCash, pScore, } new PlayerInfo[MAX_PLAYERS][pInfo]; new gPlayerLogged[MAX_PLAYERS]; #define SERVER_USER_FILE "UserAccount/%s.ini"
pawn Код:
public OnPlayerConnect(playerid)
{
// /register & /login SYstem
gPlayerLogged[playerid] = 0;
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if (!dini_Exists(file))
{
SendClientMessage(playerid,COLOR_PINK,"{88AA18}Please Register Or Input The password");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{F6358A}Deathmatch Server Registered", "Input The password", "Register", "Leave");
}
if(fexist(file))
{
SendClientMessage(playerid,COLOR_PINK,"{88AA18}This Account Registered! Please Login To COntinue Or Input The password Below");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{F6358A}This Account Is Registered", "Input your password below", "Login", "Leave");
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
dini_IntSet(file, "Kill", PlayerInfo[playerid][pKill]);
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
//GetPlayerIp(playerid,ip,sizeof(ip));
//dini_IntSet(file,"IP",ip);
}
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 1)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{F6358A}Thia Account Not Registered", "Welcome, your not registered Yet, input your registration password below", "Register", "Leave");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
//dini_IntSet(file, "Pkill"PlayerInfo[playerid][Pkill] = 0);
format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
SendClientMessage(playerid, COLOR_PINK, string);
gPlayerLogged[playerid] = 1;
}
if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{F6358A}This Account registered", "Input your password below", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid, COLOR_RED, "Wrong PassWord sir.");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{F6358A}Your Account Registered", "Input your password below", "Login", "Leave");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: You Have Successfully logged in!");
}
}
return 1;
}
i just need to know how if player loged in then can use admin system make me one tutorial..