11.10.2013, 01:26
Hello good members of samp forum.. I have a big problem..
I hope you could help me out..
So I have a problem idk why it's giving me all the time dialog Login..
So here is my code
defines:
With best regards Scrillex
I hope you could help me out..
So I have a problem idk why it's giving me all the time dialog Login..
So here is my code
defines:
pawn Код:
#define DIALOG_LOGIN (1)
#define DIALOG_VEH (30)
#define THREAD_CHECK_CREDENTIALS (3)
pawn Код:
public OnQueryFinish(query[], resultid, extraid, connectionHandle) {
switch(resultid) {
case THREAD_CHECK_CREDENTIALS: {
mysql_store_result();
if(!IsPlayerConnected(extraid)) return mysql_free_result(); // Incase they're disconnected since... Sometimes queries F*"!%$" up.
if(mysql_num_rows() == 0) { // INCORRECT PASSWORD!1
SetPVarInt(extraid, "LA", GetPVarInt(extraid, "LA") + 1);
new
playerIP[32];
if(GetPVarInt(extraid, "LA") > MAX_LOGIN_ATTEMPTS) {
SendClientMessage(extraid, COLOR_RED, "You have used all available login attempts.");
GetPlayerIp(extraid, playerIP, sizeof(playerIP));
GetPlayerName(extraid, szPlayerName, MAX_PLAYER_NAME);
format(szMessage, sizeof(szMessage), "AdmWarn: {FFFFFF}IP %s has been banned (%d failed 3 attempts on account %s).", playerIP, MAX_LOGIN_ATTEMPTS, szPlayerName);
submitToAdmins(szMessage, COLOR_HOTORANGE);
IPBan(playerIP, "Exceeded maximum login attempts.");
Kick(extraid);
return 1;
}
else {
ShowPlayerDialog(extraid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "SERVER: Login", "Welcome to the "SERVER_NAME" Server.\n\nPlease enter your password below!", "Login", "Cancel");
format(szMessage, sizeof(szMessage), "Incorrect password. You have %d remaining login attempts left.", MAX_LOGIN_ATTEMPTS - GetPVarInt(extraid, "LA"));
SendClientMessage(extraid, COLOR_HOTORANGE, szMessage);
return 1;
}
}
else {
clearScreen(extraid);
DeletePVar(extraid, "LA");
mysql_retrieve_row();
mysql_get_field("playerBanned", result);
if(strval(result) >= 1) {
new
playerIP[32];
SendClientMessage(extraid, COLOR_RED, "You are banned from this server.");
GetPlayerIp(extraid, playerIP, sizeof(playerIP));
GetPlayerName(extraid, szPlayerName, MAX_PLAYER_NAME);
format(szMessage, sizeof(szMessage), "AdmWarn: {FFFFFF}%s has attempted to evade their account ban (using IP %s).", szPlayerName, playerIP);
submitToAdmins(szMessage, COLOR_HOTORANGE);
format(szMessage, sizeof(szMessage), "Attempted ban evasion (%s).", szPlayerName);
IPBan(playerIP, szMessage);
Kick(extraid);
}
playerVariables[extraid][pBanned] = strval(result);
mysql_get_field("playerPassword", playerVariables[extraid][pPassword]);
mysql_get_field("playerEmail", playerVariables[extraid][pEmail]);
mysql_get_field("playerSkin", result);
playerVariables[extraid][pSkin] = strval(result);
mysql_get_field("playerMoney", result);
playerVariables[extraid][pMoney] = strval(result);
mysql_get_field("playerBankMoney", result);
playerVariables[extraid][pBankMoney] = strval(result);
mysql_get_field("playerPosX", result);
playerVariables[extraid][pPos][0] = floatstr(result);
mysql_get_field("playerPosY", result);
playerVariables[extraid][pPos][1] = floatstr(result);
mysql_get_field("playerPosZ", result);
playerVariables[extraid][pPos][2] = floatstr(result);
mysql_get_field("playerHealth", result);
playerVariables[extraid][pHealth] = floatstr(result);
mysql_get_field("playerArmour", result);
playerVariables[extraid][pArmour] = floatstr(result);
mysql_get_field("playerVIP", result);
playerVariables[extraid][pVIP] = strval(result);
mysql_get_field("playerSeconds", result);
playerVariables[extraid][pSeconds] = strval(result);
mysql_get_field("playerAdminLevel", result);
playerVariables[extraid][pAdminLevel] = strval(result);
if(playerVariables[extraid][pAdminLevel] > 0) {
mysql_get_field("playerAdminPIN", result);
SetPVarInt(extraid, "pAdminPIN", strval(result));
}
mysql_get_field("playerAccent", playerVariables[extraid][pAccent]);
mysql_get_field("playerInterior", result);
playerVariables[extraid][pInterior] = strval(result);
mysql_get_field("playerVirtualWorld", result);
playerVariables[extraid][pVirtualWorld] = strval(result);
mysql_get_field("playerID", result);
playerVariables[extraid][pInternalID] = strval(result);
mysql_get_field("playerCarLicensePlate", playerVariables[extraid][pCarLicensePlate]);
mysql_get_field("playerJob", result);
playerVariables[extraid][pJob] = strval(result);
mysql_get_field("playerWeapon0", result);
playerVariables[extraid][pWeapons][0] = strval(result);
mysql_get_field("playerWeapon1", result);
playerVariables[extraid][pWeapons][1] = strval(result);
mysql_get_field("playerWeapon2", result);
playerVariables[extraid][pWeapons][2] = strval(result);
mysql_get_field("playerWeapon3", result);
playerVariables[extraid][pWeapons][3] = strval(result);
mysql_get_field("playerWeapon4", result);
playerVariables[extraid][pWeapons][4] = strval(result);
mysql_get_field("playerWeapon5", result);
playerVariables[extraid][pWeapons][5] = strval(result);
mysql_get_field("playerWeapon6", result);
playerVariables[extraid][pWeapons][6] = strval(result);
mysql_get_field("playerWeapon7", result);
playerVariables[extraid][pWeapons][7] = strval(result);
mysql_get_field("playerWeapon8", result);
playerVariables[extraid][pWeapons][8] = strval(result);
mysql_get_field("playerWeapon9", result);
playerVariables[extraid][pWeapons][9] = strval(result);
mysql_get_field("playerWeapon10", result);
playerVariables[extraid][pWeapons][10] = strval(result);
mysql_get_field("playerWeapon11", result);
playerVariables[extraid][pWeapons][11] = strval(result);
mysql_get_field("playerWeapon12", result);
playerVariables[extraid][pWeapons][12] = strval(result);
mysql_get_field("playerJobSkill1", result);
playerVariables[extraid][pJobSkill][0] = strval(result);
mysql_get_field("playerJobSkill2", result);
playerVariables[extraid][pJobSkill][1] = strval(result);
mysql_get_field("playerMaterials", result);
playerVariables[extraid][pMaterials] = strval(result);
mysql_get_field("playerGroup", result);
playerVariables[extraid][pGroup] = strval(result);
mysql_get_field("playerGroupRank", result);
playerVariables[extraid][pGroupRank] = strval(result);
mysql_get_field("playerHours", result);
playerVariables[extraid][pPlayingHours] = strval(result);
mysql_get_field("playerWarning1", playerVariables[extraid][pWarning1]);
mysql_get_field("playerWarning2", playerVariables[extraid][pWarning2]);
mysql_get_field("playerWarning3", playerVariables[extraid][pWarning3]);
mysql_get_field("playerHospitalized", result);
playerVariables[extraid][pHospitalized] = strval(result);
mysql_get_field("playerAdminName", playerVariables[extraid][pAdminName]);
mysql_get_field("playerFirstLogin", result);
playerVariables[extraid][pFirstLogin] = strval(result);
mysql_get_field("playerGender", result);
playerVariables[extraid][pGender] = strval(result);
mysql_get_field("playerPrisonID", result);
playerVariables[extraid][pPrisonID] = strval(result);
mysql_get_field("playerPrisonTime", result);
playerVariables[extraid][pPrisonTime] = strval(result);
mysql_get_field("playerPhoneNumber", result);
playerVariables[extraid][pPhoneNumber] = strval(result);
mysql_get_field("playerPhoneBook", result);
playerVariables[extraid][pPhoneBook] = strval(result);
mysql_get_field("playerHelperLevel", result);
playerVariables[extraid][pHelper] = strval(result);
mysql_get_field("playerDropCarTimeout", result);
playerVariables[extraid][pDropCarTimeout] = strval(result);
mysql_get_field("playerRope", result);
playerVariables[extraid][pRope] = strval(result);
mysql_get_field("playerAdminDuty", result);
playerVariables[extraid][pAdminDuty] = strval(result);
mysql_get_field("playerCrimes", result);
playerVariables[extraid][pCrimes] = strval(result);
mysql_get_field("playerArrests", result);
playerVariables[extraid][pArrests] = strval(result);
mysql_get_field("playerWarrants", result);
playerVariables[extraid][pWarrants] = strval(result);
mysql_get_field("playerLevel", result);
playerVariables[extraid][pLevel] = strval(result);
mysql_get_field("playerAge", result);
playerVariables[extraid][pAge] = strval(result);
mysql_get_field("playerCarModel", result);
playerVariables[extraid][pCarModel] = strval(result);
mysql_get_field("playerCarMod0", result);
playerVariables[extraid][pCarMods][0] = strval(result);
mysql_get_field("playerCarMod1", result);
playerVariables[extraid][pCarMods][1] = strval(result);
mysql_get_field("playerCarMod2", result);
playerVariables[extraid][pCarMods][2] = strval(result);
mysql_get_field("playerCarMod3", result);
playerVariables[extraid][pCarMods][3] = strval(result);
mysql_get_field("playerCarMod4", result);
playerVariables[extraid][pCarMods][4] = strval(result);
mysql_get_field("playerCarMod5", result);
playerVariables[extraid][pCarMods][5] = strval(result);
mysql_get_field("playerCarMod6", result);
playerVariables[extraid][pCarMods][6] = strval(result);
mysql_get_field("playerCarMod7", result);
playerVariables[extraid][pCarMods][7] = strval(result);
mysql_get_field("playerCarMod8", result);
playerVariables[extraid][pCarMods][8] = strval(result);
mysql_get_field("playerCarMod9", result);
playerVariables[extraid][pCarMods][9] = strval(result);
mysql_get_field("playerCarMod10", result);
playerVariables[extraid][pCarMods][10] = strval(result);
mysql_get_field("playerCarMod11", result);
playerVariables[extraid][pCarMods][11] = strval(result);
mysql_get_field("playerCarMod12", result);
playerVariables[extraid][pCarMods][12] = strval(result);
mysql_get_field("playerCarPosX", result);
playerVariables[extraid][pCarPos][0] = floatstr(result);
mysql_get_field("playerCarPosY", result);
playerVariables[extraid][pCarPos][1] = floatstr(result);
mysql_get_field("playerCarPosZ", result);
playerVariables[extraid][pCarPos][2] = floatstr(result);
mysql_get_field("playerCarPosZAngle", result);
playerVariables[extraid][pCarPos][3] = floatstr(result);
mysql_get_field("playerCarColour1", result);
playerVariables[extraid][pCarColour][0] = strval(result);
mysql_get_field("playerCarColour2", result);
playerVariables[extraid][pCarColour][1] = strval(result);
mysql_get_field("playerCarPaintJob", result);
playerVariables[extraid][pCarPaintjob] = strval(result);
mysql_get_field("playerCarLock", result);
playerVariables[extraid][pCarLock] = strval(result);
mysql_get_field("playerFightStyle", result);
playerVariables[extraid][pFightStyle] = strval(result);
mysql_get_field("playerCarWeapon1", result);
playerVariables[extraid][pCarWeapons][0] = strval(result);
mysql_get_field("playerCarWeapon2", result);
playerVariables[extraid][pCarWeapons][1] = strval(result);
mysql_get_field("playerCarWeapon3", result);
playerVariables[extraid][pCarWeapons][2] = strval(result);
mysql_get_field("playerCarWeapon4", result);
playerVariables[extraid][pCarWeapons][3] = strval(result);
mysql_get_field("playerCarWeapon5", result);
playerVariables[extraid][pCarWeapons][4] = strval(result);
mysql_get_field("playerCarTrunk1", result);
playerVariables[extraid][pCarTrunk][0] = strval(result);
mysql_get_field("playerCarTrunk2", result);
playerVariables[extraid][pCarTrunk][1] = strval(result);
mysql_get_field("playerPhoneCredit", result);
playerVariables[extraid][pPhoneCredit] = strval(result);
mysql_get_field("playerWalkieTalkie", result);
playerVariables[extraid][pWalkieTalkie] = strval(result);
GetPlayerName(extraid, playerVariables[extraid][pNormalName], MAX_PLAYER_NAME);
GetPlayerIp(extraid, playerVariables[extraid][pConnectionIP], 32);
playerVariables[extraid][pStatus] = 1;
if(playerVariables[extraid][pAdminLevel] > 0) {
format(result, sizeof(result), "SELECT conIP from playerconnections WHERE conPlayerID = %d AND conIP = '%s'", playerVariables[extraid][pInternalID], playerVariables[extraid][pConnectionIP]);
mysql_query(result, THREAD_ADMIN_SECURITY, extraid);
if(GetPVarInt(extraid, "pAdminPIN") == 0)
ShowPlayerDialog(extraid, DIALOG_SET_ADMIN_PIN, DIALOG_STYLE_INPUT, "SERVER: Admin PIN creation", "The system has detected you do not yet have an admin PIN set.\n\nThis is a new compulsory security measure.\n\nPlease set a four digit pin:", "OK", "");
}
format(result, sizeof(result), "SELECT `conTS` FROM `playerconnections` WHERE `conPlayerID` = '%d' ORDER BY `conId` DESC LIMIT 1", playerVariables[extraid][pInternalID]);
mysql_query(result, THREAD_TIMESTAMP_CONNECT, extraid);
format(result, sizeof(result), "INSERT INTO playerconnections (conName, conIP, conPlayerID) VALUES('%s', '%s', %d)", playerVariables[extraid][pNormalName], playerVariables[extraid][pConnectionIP], playerVariables[extraid][pInternalID]);
mysql_query(result, THREAD_RANDOM);
format(result, sizeof(result), "UPDATE playeraccounts SET playerStatus = '1' WHERE playerID = %d", playerVariables[extraid][pInternalID]);
mysql_query(result, THREAD_RANDOM);
if(playerVariables[extraid][pFirstLogin] >= 1) {
return ShowPlayerDialog(extraid, DIALOG_QUIZ, DIALOG_STYLE_LIST, "What is OOC and IC?", "Out of clothes and In clothes\nOut of Character and In Character\nOut of car and In car", "Select", "");
}
if(playerVariables[extraid][pFirstLogin] >= 2) {
return ShowPlayerDialog(extraid, DIALOG_QUIZ1, DIALOG_STYLE_LIST, "What is Metagaming?", "Using OOC information IC\nUsing IC information OOC\nDoing something that leaves the other player no change to fight back", "Select", "");
}
if(playerVariables[extraid][pFirstLogin] >= 3) {
return ShowPlayerDialog(extraid, DIALOG_QUIZ2, DIALOG_STYLE_LIST, "What is Powergaming?", "Doing something that leaves the other player no change to fight back\nTrying to scam somebody\nTrying to level your character fast", "Select", "");
}
if(playerVariables[extraid][pFirstLogin] >= 4) {
return ShowPlayerDialog(extraid, DIALOG_QUIZ3, DIALOG_STYLE_LIST, "Wich of these is good RP example?", "/me kills everyone in this room\n* Scrillex throws Johnny_Gavin to africa\n* Scrillex pulls out a gun from his belt and turns the safety 'OFF' ", "Select", "");
}
if(playerVariables[extraid][pFirstLogin] >= 5) {
return ShowPlayerDialog(extraid, DIALOG_QUIZ4, DIALOG_STYLE_LIST, "What is Deathmatching?", "Killing player for no reason.\n Running around like chicken.\n Playing normally in RP server.", "Select", "");
}
if(playerVariables[extraid][pFirstLogin] >= 6) {
return ShowPlayerDialog(extraid, DIALOG_QUIZ5, DIALOG_STYLE_LIST, "What is Revengekilling?", "Revenging to your friend when someone has killed him \n Killing some guy who shot you earlier and you died \n Killing cops becouse they arrested you earlier", "Select", "");
}
if(playerVariables[extraid][pFirstLogin] >= 7) {
return ShowPlayerDialog(extraid, DIALOG_QUIZ6, DIALOG_STYLE_LIST, "What is Cchicken Running?", "Running right and left to avoid getting shot \n Running towards to chickens \n Trying to catch chickens", "Select", "");
}
SetSpawnInfo(extraid, 0, playerVariables[extraid][pSkin], playerVariables[extraid][pPos][0], playerVariables[extraid][pPos][1], playerVariables[extraid][pPos][2], 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(extraid);
if(playerVariables[extraid][pWarrants] > 0) {
SetPlayerWantedLevel(extraid, playerVariables[extraid][pWarrants]);
SendClientMessage(extraid, COLOR_HOTORANGE, "You're still a wanted man! Your criminal record has been reinstated.");
}
format(szQueryOutput, sizeof(szQueryOutput), "SELECT * FROM `banksuspensions` WHERE `playerID` = %d", playerVariables[extraid][pInternalID]);
mysql_query(szQueryOutput, THREAD_BANK_SUSPENSION, extraid);
if(playerVariables[extraid][pCarModel] > 0)
SpawnPlayerVehicle(extraid);
if(playerVariables[extraid][pLevel] > 0)
SetPlayerScore(extraid, playerVariables[extraid][pLevel]);
if(playerVariables[extraid][pAdminDuty] == 1 && playerVariables[extraid][pAdminLevel] < 1) {
playerVariables[extraid][pAdminLevel] = 0;
playerVariables[extraid][pAdminDuty] = 0;
format(playerVariables[extraid][pAdminName], MAX_PLAYER_NAME, "(null)");
SendClientMessage(extraid, COLOR_HOTORANGE, "You're no longer an administrator.");
}
if(playerVariables[extraid][pAdminLevel] > 0 && playerVariables[extraid][pAdminDuty] > 1)
SetPlayerName(extraid, playerVariables[extraid][pAdminName]);
}
mysql_free_result();
}
pawn Код:
OnDialog
case DIALOG_LOGIN: {
if(!response) return Kick(playerid);
new
query[300],
escapedName[MAX_PLAYER_NAME],
escapedPassword[129];
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
WP_Hash(escapedPassword, sizeof(escapedPassword), inputtext);
mysql_real_escape_string(szPlayerName, escapedName);
format(query, sizeof(query), "SELECT * FROM `playeraccounts` WHERE playerName = '%s' AND playerPassword = '%s'", escapedName, escapedPassword);
mysql_query(query, THREAD_CHECK_CREDENTIALS, playerid);
}
case DIALOG_VEH:
{
if(!response)
return 1;
switch(listitem) {
case 0:
{
if(GetPVarInt(playerid, "Lights") == 0)
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "Lights", 1);
}
else if(GetPVarInt(playerid, "Lights") == 1)
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "Lights", 0);
}
}
case 1:
{
if(GetPVarInt(playerid, "Bonnet") == 0)
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
SetPVarInt(playerid, "Bonnet", 1);
}
else if(GetPVarInt(playerid, "Bonnet") == 1)
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
SetPVarInt(playerid, "Bonnet", 0);
}
}
case 2:
{
if(GetPVarInt(playerid, "Boot") == 0)
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
SetPVarInt(playerid, "Boot", 1);
}
else if(GetPVarInt(playerid, "Boot") == 1)
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
SetPVarInt(playerid, "Boot", 0);
}
}
case 3:
{
if(GetPVarInt(playerid, "Doors") == 0)
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
SetPVarInt(playerid, "Doors", 1);
}
else if(GetPVarInt(playerid, "Doors") == 1)
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
SetPVarInt(playerid, "Doors", 0);
}
}
case 4:
{
if(GetPVarInt(playerid, "Engine") == 0)
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "Engine", 1);
}
else if(GetPVarInt(playerid, "Engine") == 1)
{
new veh = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SetPVarInt(playerid, "Engine", 0);
}
}
}
}
}
return 1;
}
With best regards Scrillex