Please Help Me With My Register System -
CarRamper - 25.06.2016
Hello Guys I Make A System That A Player Can Only register Account If He Had Played On The Server For 10 Min(s).But i Am Having A Problem That After 10 Min(s) It Saves The Account Of Player Even If He Had Not Used The /register Command To Save This Stats Please Help me i Mean To Say That It Automatically Make A Account Of That Player In Scriptfile After 10 mini(s) of Player Connect
Here is My OnPlayerConnect
Код:
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid,LW1);
TextDrawShowForPlayer(playerid,LW2);
TextDrawShowForPlayer(playerid,LW3);
TextDrawShowForPlayer(playerid,Intro0);
TextDrawShowForPlayer(playerid,Intro1);
TextDrawShowForPlayer(playerid,Intro2);
TextDrawShowForPlayer(playerid,Intro3);
TextDrawShowForPlayer(playerid,Intro4);
SetTimerEx("T2", 10000, false, "i", playerid);
}
forward T2(playerid);
public T2(playerid)
{
TextDrawHideForAll(Intro0);
TextDrawHideForAll(Intro1);
TextDrawHideForAll(Intro2);
TextDrawHideForAll(Intro3);
TextDrawHideForAll(Intro4);
if(fexist(UserPath(playerid)))
{
new string [ 240 ];
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), ""COL_WHITE"{0066FF}BilluGang Cops And Robbers\n\n{0099FF}Player Login\n\n{FFFFFF}This nick,{0099FF}%s{FFFFFF},is Registered.\nIf this is not your account,please quit and change your nick.\n\nPlease {FFFF66}Enter Your Password {FFFFFF}To Login:", pName);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""COL_WHITE"{FFFFFF}CnR {FFFFFF}Login", string, "Login", "Cancel");
}
new ConnIP[16];
GetPlayerIp(playerid,ConnIP,16);
new compare_IP[16];
new number_IP = 0;
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
GetPlayerIp(i,compare_IP,16);
if(!strcmp(compare_IP,ConnIP)) number_IP++;
}
}
if((GetTickCount() - Join_Stamp) < Time_Limit)
exceed=1;
else
exceed=0;
if(strcmp(ban_s, ConnIP, false) == 0 && exceed == 1 )
{
Same_IP++;
if(Same_IP > SAME_IP_CONNECT)
{
Ban(playerid);
Same_IP=0;
}
}
else
{
Same_IP=0;
}
if(number_IP > IP_LIMIT)
Ban(playerid);
GetStampIP(playerid);
new joinMsg[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(joinMsg, sizeof(joinMsg), "4[%d] 03*** %s has joined the server.", playerid, name);
IRC_GroupSay(gGroupID, IRC_CHANNEL, joinMsg);
TextDrawShowForPlayer(playerid, WantedLvlTxd[playerid]);
TextDrawShowForPlayer(playerid, DrugTxd[playerid]);
TextDrawShowForPlayer(playerid, DrugTxd[playerid]);
LocationTD[playerid] = TextDrawCreate(8.000000, 430.000000, "_");
TextDrawBackgroundColor(LocationTD[playerid], 255);
TextDrawFont(LocationTD[playerid], 2);
TextDrawLetterSize(LocationTD[playerid], 0.400000, 1.000000);
TextDrawColor(LocationTD[playerid], -1);
TextDrawSetOutline(LocationTD[playerid], 1);
TextDrawSetProportional(LocationTD[playerid], 1);
TextDrawUseBox(LocationTD[playerid], 1);
TextDrawBoxColor(LocationTD[playerid], 80);
TextDrawTextSize(LocationTD[playerid], 222.000000, 18.000000);
XDeaths[playerid] = 0;
LastDeath[playerid] = 0;
IsRobbing[playerid] =0;
IsBankRobbing[playerid] =0;
IsApRobbing[playerid] =0;
zoneupdates[playerid] =1;
DescriptionText[playerid] = TextDrawCreate(320.0, 380.0, " ");
TextDrawAlignment(DescriptionText[playerid], 2);
TextDrawFont(DescriptionText[playerid], 1);
TextDrawLetterSize(DescriptionText[playerid], 0.320000, 1.700000);
TextDrawSetOutline(DescriptionText[playerid], 1);
TextDrawHideForPlayer(playerid, DescriptionText[playerid]);
new string[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
format(string,sizeof string,"%s has joined the server with the ip %s",pName,plrIP);
JoinsLog(string);
for( new i = 0; i <= 50; i ++ ) SendClientMessage(playerid,COLOR_WHITE, "" );
SendClientMessage(playerid, COLOR_WHITE, "{FFFFFF}Welcome to {0066FF}Billu Gang Cops And Robbers{FFFFFF}-{0099FF}San Fierro{FFFF33}Version 1.1.");
SendClientMessage(playerid, COLOR_WHITE, "{FFFFFF}Type {FFFF33}/rules /cmds /help {FFFFFF}or visit {0099FF}cod8aw.tk {FFFFFF}For Game Info.");
SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Warning!{FFFFFF} This server (and GTA In General) Contains Explicit Material.");
SendClientMessage(playerid, COLOR_WHITE, "{FFFFFF}Select A Skin - Press {FFFF33}SHIFT {FFFFFF}To Spawn.");
for(new i;i<sizeof(Coords);i++) SetPlayerMapIcon(playerid,i,Coords[i][X],Coords[i][Y],Coords[i][Z],Coords[i][ID],0,MAPICON_LOCAL);
return 1;
}
Here Is My OnplayerDisconnect
Код:
public OnPlayerDisconnect(playerid, reason)
{
SendDeathMessage(INVALID_PLAYER_ID,playerid,201);
new leaveMsg[128], name[MAX_PLAYER_NAME], reasonMsg[8];
switch(reason)
{
case 0: reasonMsg = "Timeout";
case 1: reasonMsg = "Leaving";
case 2: reasonMsg = "Kicked";
}
GetPlayerName(playerid, name, sizeof(name));
format(leaveMsg, sizeof(leaveMsg), "4[%d] 03*** %s has left the server. (%s)", playerid, name, reasonMsg);
IRC_GroupSay(gGroupID, IRC_CHANNEL, leaveMsg);
if(fexist(UserPath(playerid)))
{
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,"WantedLevel",GetPlayerWantedLevel(playerid));
INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Condoms",PlayerInfo[playerid][pCondoms]);
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
INI_WriteInt(File,"Jailed",PlayerInfo[playerid][pJailed]);
INI_WriteInt(File,"Drugs",PlayerInfo[playerid][pDrug]);
INI_WriteInt(File,"Nopm",PlayerInfo[playerid][pNopm]);
INI_WriteInt(File,"Bank",PlayerInfo[playerid][pBank]);
INI_WriteInt(File,"Sausages",PlayerInfo[playerid][pSausage]);
INI_WriteInt(File,"PassChange",PlayerInfo[playerid][pPassChange]);
INI_WriteInt(File,"Mute",PlayerInfo[playerid][pMuted]);
INI_Close(File);
}
if(ireconnect[playerid] == 1)
{
new unbanningip[16], string[128];
GetPVarString(playerid, "reconnect", unbanningip, 16);
format(string,sizeof(string),"unbanip %s", unbanningip);
SendRconCommand(string);
printf(string);
SendRconCommand("reloadbans");
ireconnect[playerid] = 0;
}
TextDrawDestroy(LocationTD[playerid]);
return 1;
}
Here Is My OnDialogResponce
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","{FF0000}You have entered an invalid password.\n""Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"WantedLevel",0);
INI_WriteInt(File,"Vip",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Condoms",0);
INI_WriteInt(File,"Banned",0);
INI_WriteInt(File,"Jailed",0);
INI_WriteInt(File,"Drugs",0);
INI_WriteInt(File,"Nopm",0);
INI_WriteInt(File,"Bank",0);
INI_WriteInt(File,"Sausages",0);
INI_WriteInt(File,"PassChange",0);
INI_WriteInt(File,"Mute",0);
INI_Close(File);
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
TextDrawShowForPlayer(playerid,Textdraw3);
TextDrawShowForPlayer(playerid,Textdraw4);
TextDrawShowForPlayer(playerid,Textdraw5);
TextDrawShowForPlayer(playerid,Textdraw6);
TextDrawShowForPlayer(playerid,Textdraw7);
TextDrawShowForPlayer(playerid,Textdraw8);
TextDrawShowForPlayer(playerid,Textdraw9);
TextDrawShowForPlayer(playerid,Textdraw10);
}
}
case DIALOG_LOGIN:
{
if (!response) return Kick(playerid);
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pWantedLevel]);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"{008000}Success!","{FFFF00}You have successfully logged in!","Ok","");
}
else
{
new string [ 280 ];
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), ""COL_WHITE"{0066FF}BilluGang Cops And Robbers\n\n{0099FF}Player Login\n\n{FF0000}INVALID PASSWORD!\n\n{FFFFFF}This nick,{0099FF}%s{FFFFFF},is Registered.\nIf this is not your account,please quit and change your nick.\n\nPlease {FFFF66}Enter Your Password {FFFFFF}To Login:", pName);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""COL_WHITE"{FFFFFF}CnR {FFFFFF}Login", string, "Login", "Cancel");
}
return 1;
}
Here is my public OnGameModeExit()
Код:
public OnGameModeExit()
{
IRC_Quit(gBotID[0], "Bot exiting");
IRC_Quit(gBotID[1], "Bot exiting");
IRC_Quit(gBotID[2], "Bot exiting");
IRC_Quit(gBotID[3], "Bot exiting");
IRC_Quit(gBotID[4], "Bot exiting");
IRC_DestroyGroup(gGroupID);
for(new i=0;i<MAX_PLAYERS;i++)
if(fexist(UserPath(i)))
{
new INI:File = INI_Open(UserPath(i));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(i));
INI_WriteInt(File,"Admin",PlayerInfo[i][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[i][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[i][pDeaths]);
INI_WriteInt(File,"WantedLevel",GetPlayerWantedLevel(i));
INI_WriteInt(File,"Vip",PlayerInfo[i][pVip]);
INI_WriteInt(File,"Score",GetPlayerScore(i));
INI_WriteInt(File,"Condoms",PlayerInfo[i][pCondoms]);
INI_WriteInt(File,"Banned",PlayerInfo[i][pBanned]);
INI_WriteInt(File,"Jailed",PlayerInfo[i][pJailed]);
INI_WriteInt(File,"Drugs",PlayerInfo[i][pDrug]);
INI_WriteInt(File,"Nopm",PlayerInfo[i][pNopm]);
INI_WriteInt(File,"Bank",PlayerInfo[i][pBank]);
INI_WriteInt(File,"Sausages",PlayerInfo[i][pSausage]);
INI_WriteInt(File,"PassChange",PlayerInfo[i][pPassChange]);
INI_WriteInt(File,"Mute",PlayerInfo[i][pMuted]);
INI_Close(File);
TextDrawHideForPlayer(i,WantedLvlTxd[i]);
TextDrawHideForPlayer(i,DollarTxd);
TextDrawHideForPlayer(i,DrugTxd[i]);
}
TextDrawHideForAll(CopsRules0);
TextDrawDestroy(CopsRules0);
TextDrawHideForAll(CopsRules1);
TextDrawDestroy(CopsRules1);
TextDrawHideForAll(CopsRules2);
TextDrawDestroy(CopsRules2);
TextDrawHideForAll(CopsRules3);
TextDrawDestroy(CopsRules3);
TextDrawHideForAll(CopsRules4);
TextDrawDestroy(CopsRules4);
return 1;
}
Here Is /register command
Код:
CMD:register(playerid, params[])
{
if (NetStats_GetConnectedTime(playerid) < (10 * 60 * 1000))
return SendClientMessage(playerid, -1, "{FF0000}You Must Play For At Lest 10 Minutes Before Registering");
new string[ 300 ];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), ""COL_WHITE"{0066FF}BilluGang Cops And Robbers\n\n{999999}New Registration\n{FFFFFF}Nick:{0099FF}%s\n\n{FFFFFF}Do {FF0000}Not {FFFFFF}Register Multiple Accounts\n{FFFFFF}Do {FF0000}Not {FFFFFF}Use The Game Password That You Use Elsewhere\n\nPlease {FFFF66}Enter Your Password {FFFFFF}For Your Account:", pName);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"{FFFFFF}CnR {FFFFFF}Registration", string, "Register", "Cancel");
return 1;
}