public OnPlayerConnect(playerid)
{
TogglePlayerClock(playerid, 1);
SetPlayerColor(playerid, COLOR_GREY);
GetPlayerName(playerid, PlayerName[playerid], MAX_PLAYER_NAME);
new DB_Query[115];
//Resetting player information.
pInfo[playerid][Kills] = 0;
pInfo[playerid][Deaths] = 0;
pInfo[playerid][PasswordFails] = 0;
IsPlayerInLobby[playerid] = 0;
PlayerTotalKills[playerid] = 0; // We put there the killing spree of the incoming player to 0.
InArena1[playerid] = 0;
InArena2[playerid] = 0;
connected[playerid] = true;
AgainMessage[playerid] = false;
RandomWeapon[playerid] = 0;
GetPlayerName(playerid, pInfo[playerid][Name], MAX_PLAYER_NAME); // Getting the player's name.
Corrupt_Check[playerid]++;
mysql_format(Database, DB_Query, sizeof(DB_Query), "SELECT * FROM `PLAYERS` WHERE `USERNAME` = '%e' LIMIT 1", pInfo[playerid][Name]);
mysql_tquery(Database, DB_Query, "OnPlayerDataCheck", "ii", playerid, Corrupt_Check[playerid]);
// All the player's TD, will be placed there.
PYWNICA1[playerid] = TextDrawCreate(231.000000, -1.000000, "_");
TextDrawBackgroundColor(PYWNICA1[playerid], 255);
TextDrawFont(PYWNICA1[playerid], 1);
TextDrawLetterSize(PYWNICA1[playerid], 0.500000, 1.499999);
TextDrawColor(PYWNICA1[playerid], -1);
TextDrawSetOutline(PYWNICA1[playerid], 0);
TextDrawSetProportional(PYWNICA1[playerid], 1);
TextDrawSetShadow(PYWNICA1[playerid], 1);
TextDrawUseBox(PYWNICA1[playerid], 1);
TextDrawBoxColor(PYWNICA1[playerid], 100);
TextDrawTextSize(PYWNICA1[playerid], 388.000000, -13.000000);
PYWNICA2[playerid] = TextDrawCreate(262.000000, 2.000000, "samp-lsdm.ga");
TextDrawBackgroundColor(PYWNICA2[playerid], 255);
TextDrawFont(PYWNICA2[playerid], 3);
TextDrawLetterSize(PYWNICA2[playerid], 0.419999, 1.099999);
TextDrawColor(PYWNICA2[playerid], -1);
TextDrawSetOutline(PYWNICA2[playerid], 0);
TextDrawSetProportional(PYWNICA2[playerid], 1);
TextDrawSetShadow(PYWNICA2[playerid], 1);
specname[playerid] = CreatePlayerTextDraw(playerid, 14.000000, 251.000000, "_");
PlayerTextDrawBackgroundColor(playerid, specname[playerid], 255);
PlayerTextDrawFont(playerid, specname[playerid], 1);
PlayerTextDrawLetterSize(playerid, specname[playerid], 0.310000, 0.799998);
PlayerTextDrawColor(playerid, specname[playerid], -1);
PlayerTextDrawSetOutline(playerid, specname[playerid], 0);
PlayerTextDrawSetProportional(playerid, specname[playerid], 1);
PlayerTextDrawSetShadow(playerid, specname[playerid], 1);
specid[playerid] = CreatePlayerTextDraw(playerid, 14.000000, 262.000000, "_");
PlayerTextDrawBackgroundColor(playerid, specid[playerid], 255);
PlayerTextDrawFont(playerid, specid[playerid], 1);
PlayerTextDrawLetterSize(playerid, specid[playerid], 0.310000, 0.799998);
PlayerTextDrawColor(playerid, specid[playerid], -1);
PlayerTextDrawSetOutline(playerid, specid[playerid], 0);
PlayerTextDrawSetProportional(playerid, specid[playerid], 1);
PlayerTextDrawSetShadow(playerid, specid[playerid], 1);
specfps[playerid] = CreatePlayerTextDraw(playerid, 13.000000, 273.000000, "_");
PlayerTextDrawBackgroundColor(playerid, specfps[playerid], 255);
PlayerTextDrawFont(playerid, specfps[playerid], 1);
PlayerTextDrawLetterSize(playerid, specfps[playerid], 0.310000, 0.799998);
PlayerTextDrawColor(playerid, specfps[playerid], -1);
PlayerTextDrawSetOutline(playerid, specfps[playerid], 0);
PlayerTextDrawSetProportional(playerid, specfps[playerid], 1);
PlayerTextDrawSetShadow(playerid, specfps[playerid], 1);
specping[playerid] = CreatePlayerTextDraw(playerid, 14.000000, 284.000000, "_");
PlayerTextDrawBackgroundColor(playerid, specping[playerid], 255);
PlayerTextDrawFont(playerid, specping[playerid], 1);
PlayerTextDrawLetterSize(playerid, specping[playerid], 0.310000, 0.799998);
PlayerTextDrawColor(playerid, specping[playerid], -1);
PlayerTextDrawSetOutline(playerid, specping[playerid], 0);
PlayerTextDrawSetProportional(playerid, specping[playerid], 1);
PlayerTextDrawSetShadow(playerid, specping[playerid], 1);
specpacketloss[playerid] = CreatePlayerTextDraw(playerid, 14.000000, 296.000000, "_");
PlayerTextDrawBackgroundColor(playerid, specpacketloss[playerid], 255);
PlayerTextDrawFont(playerid, specpacketloss[playerid], 1);
PlayerTextDrawLetterSize(playerid, specpacketloss[playerid], 0.310000, 0.799998);
PlayerTextDrawColor(playerid, specpacketloss[playerid], -1);
PlayerTextDrawSetOutline(playerid, specpacketloss[playerid], 0);
PlayerTextDrawSetProportional(playerid, specpacketloss[playerid], 1);
PlayerTextDrawSetShadow(playerid, specpacketloss[playerid], 1);
spectatorinfo[playerid] = CreatePlayerTextDraw(playerid, 22.000000, 232.000000, "SPECTATOR INFO");
PlayerTextDrawBackgroundColor(playerid, spectatorinfo[playerid], 255);
PlayerTextDrawFont(playerid, spectatorinfo[playerid], 1);
PlayerTextDrawLetterSize(playerid, spectatorinfo[playerid], 0.379999, 1.499999);
PlayerTextDrawColor(playerid, spectatorinfo[playerid], -1);
PlayerTextDrawSetOutline(playerid, spectatorinfo[playerid], 0);
PlayerTextDrawSetProportional(playerid, spectatorinfo[playerid], 1);
PlayerTextDrawSetShadow(playerid, spectatorinfo[playerid], 1);
spechealth[playerid] = CreatePlayerTextDraw(playerid, 14.000000, 309.000000, "_");
PlayerTextDrawBackgroundColor(playerid, spechealth[playerid], 255);
PlayerTextDrawFont(playerid, spechealth[playerid], 1);
PlayerTextDrawLetterSize(playerid, spechealth[playerid], 0.310000, 0.799998);
PlayerTextDrawColor(playerid, spechealth[playerid], -1);
PlayerTextDrawSetOutline(playerid, spechealth[playerid], 0);
PlayerTextDrawSetProportional(playerid, spechealth[playerid], 1);
PlayerTextDrawSetShadow(playerid, spechealth[playerid], 1);
// Transparent black bar
blackBAR[playerid] = TextDrawCreate(660.000000, 432.000000, "_");
TextDrawBackgroundColor(blackBAR[playerid], 255);
TextDrawFont(blackBAR[playerid], 1);
TextDrawLetterSize(blackBAR[playerid], 0.500000, 2.500000);
TextDrawColor(blackBAR[playerid], -1);
TextDrawSetOutline(blackBAR[playerid], 0);
TextDrawSetProportional(blackBAR[playerid], 1);
TextDrawSetShadow(blackBAR[playerid], 1);
TextDrawUseBox(blackBAR[playerid], 1);
TextDrawBoxColor(blackBAR[playerid], 100);
TextDrawTextSize(blackBAR[playerid], -20.000000, -21.000000);
// Points Textdraw's
CASH[playerid] = TextDrawCreate(495.000000, 79.000000, "_");
TextDrawBackgroundColor(CASH[playerid],255);
TextDrawFont(CASH[playerid], 1);
TextDrawLetterSize(CASH[playerid], 0.529999, 2.000000);
TextDrawColor(CASH[playerid], -1);
TextDrawSetOutline(CASH[playerid], 0);
TextDrawSetProportional(CASH[playerid], 1);
TextDrawSetShadow(CASH[playerid], 1);
TextDrawUseBox(CASH[playerid], 1);
TextDrawBoxColor(CASH[playerid], 227526655);
TextDrawTextSize(CASH[playerid], 613.000000, 11.000000);
// You killed: Wallen, Killed By: Wallen.
killed[playerid] = CreatePlayerTextDraw(playerid, 247.000000, 347.000000, "___");
PlayerTextDrawBackgroundColor(playerid, killed[playerid], 255);
PlayerTextDrawFont(playerid, killed[playerid], 1);
PlayerTextDrawLetterSize(playerid, killed[playerid], 0.429999, 1.899999);
PlayerTextDrawColor(playerid, killed[playerid], 227526655);
PlayerTextDrawSetOutline(playerid, killed[playerid], 0);
PlayerTextDrawSetProportional(playerid, killed[playerid], 1);
PlayerTextDrawSetShadow(playerid, killed[playerid], 1);
killedby[playerid] = CreatePlayerTextDraw(playerid, 247.000000, 347.000000, "___");
PlayerTextDrawBackgroundColor(playerid, killedby[playerid], 255);
PlayerTextDrawFont(playerid, killedby[playerid], 1);
PlayerTextDrawLetterSize(playerid, killedby[playerid], 0.429999, 1.899999);
PlayerTextDrawColor(playerid, killedby[playerid], 227526655);
PlayerTextDrawSetOutline(playerid, killedby[playerid], 0);
PlayerTextDrawSetProportional(playerid, killedby[playerid], 1);
PlayerTextDrawSetShadow(playerid, killedby[playerid], 1);
// Points Textdraw's
EARNS[playerid] = CreatePlayerTextDraw(playerid, 301.000000, 100.000000, "+");
PlayerTextDrawBackgroundColor(playerid, EARNS[playerid], 255);
PlayerTextDrawFont(playerid, EARNS[playerid], 2);
PlayerTextDrawLetterSize(playerid, EARNS[playerid], 0.449999, 2.099999);
PlayerTextDrawColor(playerid, EARNS[playerid], 227526655);
PlayerTextDrawSetOutline(playerid, EARNS[playerid], 0);
PlayerTextDrawSetProportional(playerid, EARNS[playerid], 1);
PlayerTextDrawSetShadow(playerid, EARNS[playerid], 1);
CASH2[playerid] = TextDrawCreate(497.000000, 81.000000, "_");
TextDrawBackgroundColor(CASH2[playerid], 255);
TextDrawFont(CASH2[playerid], 1);
TextDrawLetterSize(CASH2[playerid], 0.500000, 1.599999);
TextDrawColor(CASH2[playerid], -1);
TextDrawSetOutline(CASH2[playerid], 0);
TextDrawSetProportional(CASH2[playerid], 1);
TextDrawSetShadow(CASH2[playerid], 1);
TextDrawUseBox(CASH2[playerid], 1);
TextDrawBoxColor(CASH2[playerid], 255);
TextDrawTextSize(CASH2[playerid], 611.000000, 11.000000);
/*
CASH3[playerid] = TextDrawCreate(527.000000, 105.000000, "points");
TextDrawBackgroundColor(CASH3[playerid], 44627711);
TextDrawFont(CASH3[playerid], 3);
TextDrawLetterSize(CASH3[playerid], 0.480000, 1.099999);
TextDrawColor(CASH3[playerid], 255);
TextDrawSetOutline(CASH3[playerid], 1);
TextDrawSetProportional(CASH3[playerid], 1);
TextDrawUseBox(CASH3[playerid], 1);
TextDrawBoxColor(CASH3[playerid], 255);
TextDrawTextSize(CASH3[playerid], 580.000000, 1.000000);
*/
CASH4[playerid] = TextDrawCreate(500.000000, 79.000000, "$0000000");
TextDrawBackgroundColor(CASH4[playerid], 632941823);
TextDrawFont(CASH4[playerid], 3);
TextDrawLetterSize(CASH4[playerid], 0.600000, 2.000000);
TextDrawColor(CASH4[playerid], 255);
TextDrawSetOutline(CASH4[playerid], 1);
TextDrawSetProportional(CASH4[playerid], 1);
// Health Textdraw
HPP[playerid] = TextDrawCreate(20.000000, 431.000000, "HP: 100");
TextDrawBackgroundColor(HPP[playerid], 16711935);
TextDrawFont(HPP[playerid], 3);
TextDrawLetterSize(HPP[playerid], 0.449999, 1.800000);
TextDrawColor(HPP[playerid], 255);
TextDrawSetOutline(HPP[playerid], 1);
TextDrawSetProportional(HPP[playerid], 1);
// Killingspree textdraw.
KILLINGSPREE[playerid] = CreatePlayerTextDraw(playerid, -36.000000, 241.000000, "_");
PlayerTextDrawBackgroundColor(playerid, KILLINGSPREE[playerid], 255);
PlayerTextDrawFont(playerid, KILLINGSPREE[playerid], 1);
PlayerTextDrawLetterSize(playerid, KILLINGSPREE[playerid], 1.070000, 1.599999);
PlayerTextDrawColor(playerid, KILLINGSPREE[playerid], -1);
PlayerTextDrawSetOutline(playerid, KILLINGSPREE[playerid], 0);
PlayerTextDrawSetProportional(playerid, KILLINGSPREE[playerid], 1);
PlayerTextDrawSetShadow(playerid, KILLINGSPREE[playerid], 1);
PlayerTextDrawUseBox(playerid, KILLINGSPREE[playerid], 1);
PlayerTextDrawBoxColor(playerid, KILLINGSPREE[playerid], 90);
PlayerTextDrawTextSize(playerid, KILLINGSPREE[playerid], 180.000000, 0.000000);
KILLINGSPREE2[playerid] = CreatePlayerTextDraw(playerid, 8.000000, 239.000000, "Killingstreak= 0");
PlayerTextDrawBackgroundColor(playerid, KILLINGSPREE2[playerid], 255);
PlayerTextDrawFont(playerid, KILLINGSPREE2[playerid], 3);
PlayerTextDrawLetterSize(playerid, KILLINGSPREE2[playerid], 0.470000, 1.899999);
PlayerTextDrawColor(playerid, KILLINGSPREE2[playerid], 227526655);
PlayerTextDrawSetOutline(playerid, KILLINGSPREE2[playerid], 0);
PlayerTextDrawSetProportional(playerid, KILLINGSPREE2[playerid], 1);
PlayerTextDrawSetShadow(playerid, KILLINGSPREE2[playerid], 2);
// Just a KILLS player info textdraw.
KILLS[playerid] = TextDrawCreate(152.000000, 439.000000, "Kills:0");
TextDrawBackgroundColor(KILLS[playerid], 227525802);
TextDrawFont(KILLS[playerid], 3);
TextDrawLetterSize(KILLS[playerid], 0.500000, 0.899999);
TextDrawColor(KILLS[playerid], 255);
TextDrawSetOutline(KILLS[playerid], 1);
TextDrawSetProportional(KILLS[playerid], 1);
DEATHS[playerid] = TextDrawCreate(255.000000, 439.000000, "Deaths: 0");
TextDrawBackgroundColor(DEATHS[playerid], 227525802);
TextDrawFont(DEATHS[playerid], 3);
TextDrawLetterSize(DEATHS[playerid], 0.500000, 0.899999);
TextDrawColor(DEATHS[playerid], 255);
TextDrawSetOutline(DEATHS[playerid], 1);
TextDrawSetProportional(DEATHS[playerid], 1);
RATIO[playerid] = TextDrawCreate(379.000000, 439.000000, "Ratio:0.00");
TextDrawBackgroundColor(RATIO[playerid], 227525802);
TextDrawFont(RATIO[playerid], 3);
TextDrawLetterSize(RATIO[playerid], 0.500000, 0.899999);
TextDrawColor(RATIO[playerid], 255);
TextDrawSetOutline(RATIO[playerid], 1);
TextDrawSetProportional(RATIO[playerid], 1);
LEVEL[playerid] = TextDrawCreate(485.000000, 439.000000, "Level: 0");
TextDrawBackgroundColor(LEVEL[playerid], 227525802);
TextDrawFont(LEVEL[playerid], 3);
TextDrawLetterSize(LEVEL[playerid], 0.500000, 0.899999);
TextDrawColor(LEVEL[playerid], 255);
TextDrawSetOutline(LEVEL[playerid], 1);
TextDrawSetProportional(LEVEL[playerid], 1);
// Network TD playerid.
FPSXD[playerid] = TextDrawCreate(601.000000, 432.000000, "FPS: 50");
TextDrawBackgroundColor(FPSXD[playerid], 255);
TextDrawFont(FPSXD[playerid], 2);
TextDrawLetterSize(FPSXD[playerid], 0.180000, 0.599999);
TextDrawColor(FPSXD[playerid], 227526655);
TextDrawSetOutline(FPSXD[playerid], 0);
TextDrawSetProportional(FPSXD[playerid], 1);
TextDrawSetShadow(FPSXD[playerid], 1);
PINGXD[playerid] = TextDrawCreate(601.000000, 440.000000, "PING: 60");
TextDrawBackgroundColor(PINGXD[playerid], 255);
TextDrawFont(PINGXD[playerid], 2);
TextDrawLetterSize(PINGXD[playerid], 0.180000, 0.599999);
TextDrawColor(PINGXD[playerid], 227526655);
TextDrawSetOutline(PINGXD[playerid], 0);
TextDrawSetProportional(PINGXD[playerid], 1);
TextDrawSetShadow(PINGXD[playerid], 1);
// Spectator Info TD
blackspecbox = TextDrawCreate(14.000000, 250.000000, "_");
TextDrawBackgroundColor(blackspecbox, 255);
TextDrawFont(blackspecbox, 1);
TextDrawLetterSize(blackspecbox, 0.950000, 8.299997);
TextDrawColor(blackspecbox, -1);
TextDrawSetOutline(blackspecbox, 0);
TextDrawSetProportional(blackspecbox, 1);
TextDrawSetShadow(blackspecbox, 1);
TextDrawUseBox(blackspecbox, 1);
TextDrawBoxColor(blackspecbox, 70);
TextDrawTextSize(blackspecbox, 137.000000, 0.000000);
//Black death box
deathbox1 = TextDrawCreate(660.000000, -11.000000, "_");
TextDrawBackgroundColor(deathbox1, 255);
TextDrawFont(deathbox1, 1);
TextDrawLetterSize(deathbox1, 0.500000, 7.000000);
TextDrawColor(deathbox1, -1);
TextDrawSetOutline(deathbox1, 0);
TextDrawSetProportional(deathbox1, 1);
TextDrawSetShadow(deathbox1, 1);
TextDrawUseBox(deathbox1, 1);
TextDrawBoxColor(deathbox1, 140);
TextDrawTextSize(deathbox1, -250.000000, 0.000000);
deathbox2 = TextDrawCreate(660.000000, 394.000000, "_");
TextDrawBackgroundColor(deathbox2, 255);
TextDrawFont(deathbox2, 1);
TextDrawLetterSize(deathbox2, 0.500000, 7.000000);
TextDrawColor(deathbox2, -1);
TextDrawSetOutline(deathbox2, 0);
TextDrawSetProportional(deathbox2, 1);
TextDrawSetShadow(deathbox2, 1);
TextDrawUseBox(deathbox2, 1);
TextDrawBoxColor(deathbox2, 140);
TextDrawTextSize(deathbox2, -250.000000, 0.000000);
// End of player's TD's.
// Announcing a new player connection (DONT DELETE ANYTHING FROM THERE)
new str[500], name[MAX_PLAYER_NAME];
new ip[16], country[32], isp[32], city[32];
GetPlayerName(playerid, name, sizeof(name));
if(pInfo[playerid][Admin] == 1)
{
GetIPCountry(ip, country, sizeof country);
GetPlayerIp(playerid,ip,sizeof(ip));
format(str,sizeof(str), "{c3c3c3}* (INFO) %s joined the game (ID: %d || Country: %s )",name, playerid, country);
SendMessageToAdmins(str);
}
else if(pInfo[playerid][Admin] == 2)
{
GetPlayerIp(playerid, ip, 16);
GetIPCountry(ip, country, sizeof country);
GetIPISP(ip, isp, sizeof isp);
GetIPCity(ip, city, sizeof city);
GetPlayerIp(playerid,ip,sizeof(ip));
format(str,sizeof(str), "{c3c3c3}* (INFO) %s joined the game (ID: %d || IP: %s || Country: %s || City: %s || ISP: %s)",name, playerid, ip, country, city, isp);
SendMessageToAdmins(str);
}
else if(pInfo[playerid][Admin] == 3)
{
GetPlayerIp(playerid, ip, 16);
GetIPCountry(ip, country, sizeof country);
GetIPISP(ip, isp, sizeof isp);
GetIPCity(ip, city, sizeof city);
GetPlayerIp(playerid,ip,sizeof(ip));
format(str,sizeof(str), "{c3c3c3}* (INFO) %s joined the game (ID: %d || IP: %s || Country: %s || City: %s || ISP: %s)",name, playerid, ip, country, city, isp);
SendMessageToAdmins(str);
}
format(str,sizeof(str), "{c3c3c3}(INFO) %s (ID: %d) joined the game !",name, playerid);
SendClientMessageToAll(playerid, str);
// Messages
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "{1DBAF7}(INFO) Please check /cmds(/commands), /respect, /points, /rules to know more about the server.");
// Detecting the player TAG. if he have [SN] tag he gonna be recognized as server Owner.
if(strfind(name, TAGCLAN, true) == 0)
{
}
if(strfind(name, FAKETAG, true) == 0)
{
new we[128], namme[MAX_PLAYER_NAME];
GetPlayerName(playerid, namme,sizeof(namme));
format(we,sizeof(we), "%s, your nickname is not allowed to join this server, please change your nick and then relog.",namme);
SendClientMessage(playerid, -1,we);
SetTimerEx("KickMessage", 1000, false, "i", playerid);
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch (dialogid)
{
case DIALOG_LOGIN:
{
if(!response) return Kick(playerid);
new Salted_Key[65];
SHA256_PassHash(inputtext, pInfo[playerid][Salt], Salted_Key, 65);
if(strcmp(Salted_Key, pInfo[playerid][Password]) == 0)
{
// Now, password should be correct as well as the strings
// Matched with each other, so nothing is wrong until now.
// We will activate the cache of player to make use of it e.g.
// Retrieve their data.
cache_set_active(pInfo[playerid][Player_Cache]);
// Okay, we are retrieving the information now..
cache_get_value_int(0, "ID", pInfo[playerid][ID]);
cache_get_value_int(0, "KILLS", pInfo[playerid][Kills]);
cache_get_value_int(0, "ADMIN", pInfo[playerid][Admin]);
cache_get_value_int(0, "POINTS", pInfo[playerid][Points]);
cache_get_value_int(0, "RESPECT", pInfo[playerid][Respect]);
cache_get_value_int(0, "DEATHS", pInfo[playerid][Deaths]);
cache_get_value_int(0, "SCORE", pInfo[playerid][Score]);
cache_get_value_int(0, "CASH", pInfo[playerid][Cash]);
SetPlayerScore(playerid, pInfo[playerid][Score]);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, pInfo[playerid][Cash]);
// So, we have successfully retrieved data? Now deactivating the cache.
cache_delete(pInfo[playerid][Player_Cache]);
pInfo[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
pInfo[playerid][LoggedIn] = true;
new str[500], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name,sizeof(name));
format(str,sizeof(str),"{00FFFF}* Successfully logged in! Welcome back {FFFFFF}%s{00FFFF}, type {FFFFFF}/stats {00FFFF}to see your saved statistics.",name);
SendClientMessage(playerid, -1, str);
TogglePlayerSpectating(playerid, 0);
}
else
{
new String[500];
pInfo[playerid][PasswordFails] += 1;
printf("%s has been failed to login. (%d)", pInfo[playerid][Name], pInfo[playerid][PasswordFails]);
// Printing the message that someone has failed to login to his account.
if (pInfo[playerid][PasswordFails] >= 3) // If the fails exceeded the limit we kick the player.
{
format(String, sizeof(String), "{FF0000}* You have been kicked Reason: {FF0000}(%d/3) Login fails.",pInfo[playerid][PasswordFails]);
SendClientMessage(playerid, -1, String);
SetTimerEx("KickMessage", 1000, false, "i", playerid);
}
else
{
// If the player didn't exceed the limits we send him a message that the password is wrong.
format(String, sizeof(String), "{D8D8D8}* Wrong password, you have %d out of 3 tries.", pInfo[playerid][PasswordFails]);
SendClientMessage(playerid, -1, String);
format(String, sizeof(String), "\nWelcome back %s \n\n{4286f4}This account looks like already registered on our database!\n{4286f4}Please insert your password below in order to login!\n\n{FF0000}* Wrong password.", pInfo[playerid][Name]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{4286f4}Account Login", String, "Login", "Leave");
}
}
}
case DIALOG_REGISTER:
{
if(!response) return Kick(playerid);
if(strlen(inputtext) <= 5 || strlen(inputtext) > 60)
{
// If the password length is less than or equal to 5 and more than 60
// It repeats the process and shows error message as seen below.
SendClientMessage(playerid, -1, "{FF0000}* Invalid password length, should be 5 - 60.");
new String[500];
format(String, sizeof(String), "Welcome %s to {EFB509}Los Santos DeathMatch Battleground\n\n{4286f4}This account is not registered!\n{4286f4}Please insert your password below in order to create an account and play!\n\n{FF0000}* Password too short.", pInfo[playerid][Name]);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{4286f4}Account Registration", String, "Register", "Leave");
}
else
{
// Salting the player's password using SHA256 for a better security.
for (new i = 0; i < 10; i++)
{
pInfo[playerid][Salt][i] = random(79) + 47;
}
pInfo[playerid][Salt][10] = 0;
SHA256_PassHash(inputtext, pInfo[playerid][Salt], pInfo[playerid][Password], 65);
new DB_Query[225];
// Storing player's information if everything goes right.
mysql_format(Database, DB_Query, sizeof(DB_Query), "INSERT INTO `PLAYERS` (`USERNAME`, `PASSWORD`, `SALT`, `SCORE`, `KILLS`, `CASH`, `DEATHS`, `RESPECT`, `POINTS`)\
VALUES ('%e', '%s', '%e', '20', '0', '0', '0')", pInfo[playerid][Name], pInfo[playerid][Password], pInfo[playerid][Salt]);
mysql_tquery(Database, DB_Query, "OnPlayerRegister", "d", playerid);
}
}
}
if(dialogid == DIALOGCLAN)
{
if(strlen(inputtext)) //If they didn't enter any password
{
if(!strcmp(inputtext, PASSWORDCLAN, false))
{
SendClientMessage(playerid, -1, "{4286f4}* You have been confirmed to be part of [SN] clan!");
return 1;
}
else
{
SendClientMessage(playerid, -1, "{FF0000}* You have been kicked for failed login (1 of 1)!");
SetTimerEx("OnPlayerKicked", 100, false, "i", playerid);
}
}
else
{
SendClientMessage(playerid, -1, "{FF0000}* You have been kicked for not being able to enter the correct clan password (go away)!");
SendClientMessage(playerid, -1, "{FF0000}* Your IP has been saved on logs and will be banned!");
SetTimerEx("OnPlayerKicked", 100, false, "i", playerid);
}
}
if(dialogid == DIALOG_WEAP)
{
if(response)
{
switch(listitem)
{
case 0:SellWeapon(playerid, 15, 24, 100);
case 1:SellWeapon(playerid, 10, 25, 40);
case 2:SellWeapon(playerid, 40, 27, 100);
case 3:SellWeapon(playerid, 10, 31, 90);
case 4:SellWeapon(playerid, 30, 34, 30);
case 5:SellWeapon(playerid, 150, 1100, 100);
}
}
}
return 1;
}
|
Same issue @jasp,
I'm not worrying about not being able to spawn now, Why when I relog it tells me to register again? |
---------- Loaded log file: "server_log.txt". ---------- SA-MP Dedicated Server ---------------------- v0.3.7-R2, ©2005-2015 SA-MP Team [17:17:19] [17:17:19] Server Plugins [17:17:19] -------------- [17:17:19] Loading plugin: sscanf [17:17:19] [17:17:19] =============================== [17:17:19] sscanf plugin loaded. [17:17:19] Version: 2.8.2 [17:17:19] © 2012 Alex "******" Cole [17:17:19] =============================== [17:17:19] Loaded. [17:17:19] Loading plugin: SKY [17:17:19] Loaded. [17:17:19] Loading plugin: mysql [17:17:19] >> plugin.mysql: R41-2 successfully loaded. [17:17:19] Loaded. [17:17:19] Loaded 3 plugins. [17:17:19] [17:17:19] Filterscripts [17:17:19] --------------- [17:17:19] Loading filterscript 'TextDrawEditor1.0.amx'... [17:17:19] -------------------------------------- [17:17:19] Text Draw Editor 1.0RC2 by Zamaroht for SA-MP 0.3 Loaded. [17:17:19] -------------------------------------- [17:17:19] Loaded 1 filterscripts. [17:17:19] [17:17:19] [17:17:19] [17:17:19] ======================================= [17:17:19] | | [17:17:19] | YSI version 4.00.0001 | [17:17:19] | By Alex "******" Cole | [17:17:19] | | [17:17:19] ======================================= [17:17:19] [17:17:19] Loaded 24 vehicles from: vehicles/ls_law.txt [17:17:19] Loaded 37 vehicles from: vehicles/ls_airport.txt [17:17:19] Loaded 98 vehicles from: vehicles/ls_gen_inner.txt [17:17:19] Loaded 389 vehicles from: vehicles/ls_gen_outer.txt [17:17:19] I have connected to the MySQL server. [17:17:19] ------------------------------------------------------ [17:17:19] Number of vehicle models: 97 [17:17:43] [connection] 127.0.0.1:60407 requests connection cookie. [17:17:44] [connection] incoming connection: 127.0.0.1:60407 id: 0 [17:17:44] [join] test has joined the server (0:127.0.0.1) [17:17:53] [part] test has left the server (0:1)
forward public OnPlayerDataCheck(playerid, corrupt_check);
public OnPlayerDataCheck(playerid, corrupt_check)
{
if (corrupt_check != Corrupt_Check[playerid]) return Kick(playerid);
// You'd have asked already what's corrput_check and how it'd benefit me?
// Well basically MySQL query takes long, incase a player leaves while its not proceeded
// With ID 1 for example, then another player comes as ID 1 it'll basically corrupt the data
// So, once the query is done, the player will have the wrong data assigned for himself.
new String[500];
if(cache_num_rows() > 0)
{
// If the player exists, everything is okay and nothing is wrongly detected
// The player's password and Saltion key gets stored as seen below
// So we won't have to get a headache just to match player's password.
cache_get_value(0, "PASSWORD", pInfo[playerid][Password], 65);
cache_get_value(0, "SALT", pInfo[playerid][Salt], 11);
pInfo[playerid][Player_Cache] = cache_save();
// ^ Storing the cache ID of the player for further use later.
format(String, sizeof(String), "\nWelcome back %s,\n\n{4286f4}This account is already registered in the database!\n{4286f4}Please insert your password below in order to login!\n\n{FF0000}If you forgot your password,\nyou can request new one at http//www.samp-lsdm.ga/", pInfo[playerid][Name]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{4286f4}Account Login", String, "Login", "Leave");
InterpolateCameraPos(playerid, 1310.176391, -877.248474, 77.258483, 1524.201293, -896.259704, 77.258483, 1000);
InterpolateCameraLookAt(playerid, 1314.636230, -874.994384, 77.429840, 1520.751831, -892.646789, 77.039543, 1000);
}
else
{
format(String, sizeof(String), "Welcome %s to {EFB509}Los Santos DeathMatch Battleground\n\n{4286f4}This account is not registered!\n{4286f4}Please insert your password below in order to create an account and play!", pInfo[playerid][Name]);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{4286f4}Account Registration", String, "Register", "Leave");
InterpolateCameraPos(playerid, 1310.176391, -877.248474, 77.258483, 1524.201293, -896.259704, 77.258483, 1000);
InterpolateCameraLookAt(playerid, 1314.636230, -874.994384, 77.429840, 1520.751831, -892.646789, 77.039543, 1000);
}
return 1;
}