31.05.2012, 00:28
(
Last edited by iFederal; 23/06/2012 at 01:37 PM.
)
-delete- self fixed.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_GATE)
{
new i = OpeningGate[playerid];
new password[MAX_STRING];
if(response)
{
if(!strlen(inputtext))
{
OpeningGate[playerid] = 9999;
TogglePlayerControllable(playerid,1);
return 1;
}
strmid(password, inputtext, 0, strlen(inputtext), 255);
if(strcmp(GateInfo[i][gGatePassword],password, true ) == 0 )
{
if(GateInfo[i][gGateStatus] == 0)
{
OpeningGate[playerid] = 9999;
GateInfo[i][gGateStatus] = 1;
MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGateMoveX], GateInfo[i][gGateMoveY], GateInfo[i][gGateMoveZ], GateInfo[i][gGateSpeed], GateInfo[i][gGateMoveRX], GateInfo[i][gGateMoveRY], GateInfo[i][gGateMoveRZ]);
SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly opened the gate.");
TogglePlayerControllable(playerid,1);
SaveGate(i);
}
else
{
OpeningGate[playerid] = 9999;
GateInfo[i][gGateStatus] = 0;
MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGatePosX], GateInfo[i][gGatePosY], GateInfo[i][gGatePosZ], GateInfo[i][gGateSpeed], GateInfo[i][gGatePosRX], GateInfo[i][gGatePosRY], GateInfo[i][gGatePosRZ]);
SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly closed the gate.");
TogglePlayerControllable(playerid,1);
SaveGate(i);
}
}
else
{
OpeningGate[playerid] = 9999;
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid, COLOR_GREY, " You have typed in a wrong password.");
return 1;
}
}
else
{
OpeningGate[playerid] = 9999;
TogglePlayerControllable(playerid,1);
return 1;
}
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"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,"Bank Account", 0);
INI_WriteInt(File,"Playing Hours", 0);
INI_WriteInt(File,"Faction", 0);
INI_WriteInt(File,"Leader", 0);
INI_WriteInt(File,"Job", 0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome, your account has been saved to our Database!","Ok","");
}
}
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(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_GATE)
{
new i = OpeningGate[playerid];
new password[MAX_STRING];
if(response)
{
if(!strlen(inputtext))
{
OpeningGate[playerid] = 9999;
TogglePlayerControllable(playerid,1);
return 1;
}
strmid(password, inputtext, 0, strlen(inputtext), 255);
if(strcmp(GateInfo[i][gGatePassword],password, true ) == 0 )
{
if(GateInfo[i][gGateStatus] == 0)
{
OpeningGate[playerid] = 9999;
GateInfo[i][gGateStatus] = 1;
MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGateMoveX], GateInfo[i][gGateMoveY], GateInfo[i][gGateMoveZ], GateInfo[i][gGateSpeed], GateInfo[i][gGateMoveRX], GateInfo[i][gGateMoveRY], GateInfo[i][gGateMoveRZ]);
SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly opened the gate.");
TogglePlayerControllable(playerid,1);
SaveGate(i);
}
else
{
OpeningGate[playerid] = 9999;
GateInfo[i][gGateStatus] = 0;
MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGatePosX], GateInfo[i][gGatePosY], GateInfo[i][gGatePosZ], GateInfo[i][gGateSpeed], GateInfo[i][gGatePosRX], GateInfo[i][gGatePosRY], GateInfo[i][gGatePosRZ]);
SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly closed the gate.");
TogglePlayerControllable(playerid,1);
SaveGate(i);
}
}
else
{
OpeningGate[playerid] = 9999;
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid, COLOR_GREY, " You have typed in a wrong password.");
return 1;
}
}
else
{
OpeningGate[playerid] = 9999;
TogglePlayerControllable(playerid,1);
return 1;
}
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"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,"Bank Account", 0);
INI_WriteInt(File,"Playing Hours", 0);
INI_WriteInt(File,"Faction", 0);
INI_WriteInt(File,"Leader", 0);
INI_WriteInt(File,"Job", 0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome, your account has been saved to our Database!","Ok","");
}
}
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(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
}
}
|
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_GATE)
{
new i = OpeningGate[playerid];
new password[MAX_STRING];
if(response)
{
if(!strlen(inputtext))
{
OpeningGate[playerid] = 9999;
TogglePlayerControllable(playerid,1);
return 1;
}
strmid(password, inputtext, 0, strlen(inputtext), 255);
if(strcmp(GateInfo[i][gGatePassword],password, true ) == 0 )
{
if(GateInfo[i][gGateStatus] == 0)
{
OpeningGate[playerid] = 9999;
GateInfo[i][gGateStatus] = 1;
MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGateMoveX], GateInfo[i][gGateMoveY], GateInfo[i][gGateMoveZ], GateInfo[i][gGateSpeed], GateInfo[i][gGateMoveRX], GateInfo[i][gGateMoveRY], GateInfo[i][gGateMoveRZ]);
SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly opened the gate.");
TogglePlayerControllable(playerid,1);
SaveGate(i);
}
else
{
OpeningGate[playerid] = 9999;
GateInfo[i][gGateStatus] = 0;
MoveDynamicObject(GateInfo[i][gGateID], GateInfo[i][gGatePosX], GateInfo[i][gGatePosY], GateInfo[i][gGatePosZ], GateInfo[i][gGateSpeed], GateInfo[i][gGatePosRX], GateInfo[i][gGatePosRY], GateInfo[i][gGatePosRZ]);
SendClientMessage(playerid,COLOR_WHITE,"You have succesfuly closed the gate.");
TogglePlayerControllable(playerid,1);
SaveGate(i);
}
}
else
{
OpeningGate[playerid] = 9999;
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid, COLOR_GREY, " You have typed in a wrong password.");
return 1;
}
}
else
{
OpeningGate[playerid] = 9999;
TogglePlayerControllable(playerid,1);
return 1;
}
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"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,"Bank Account", 0);
INI_WriteInt(File,"Playing Hours", 0);
INI_WriteInt(File,"Faction", 0);
INI_WriteInt(File,"Leader", 0);
INI_WriteInt(File,"Job", 0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome, your account has been saved to our Database!","Ok","");
}
}
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(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
}
}
|