04.07.2012, 17:22
(
Последний раз редактировалось syruz; 05.07.2012 в 05:53.
)
I have been working on this for weeks and cannot for the life of me figure out what the fuck is wrong with it:
This is after trying to figure out how to swap from one old outdated mysql plugin to BlueG's One
pawn Код:
public OnPlayerLogin(playerid, password[])
{
SetPVarInt(playerid,"Spectating",0);
TogglePlayerSpectating(playerid, 0);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
new name[MAX_PLAYER_NAME], str[128],ip[20], query[1024], data[256];// cmdtext;
GetPlayerName(playerid, name, sizeof name);
GetPlayerIp(playerid,ip,sizeof ip);
// format(query, sizeof(query),"UPDATE Player_Data SET ip='%s' WHERE username='%s'", ip, PlayerName(playerid));
// mysql_query(query);
format(query, sizeof(query), "SELECT * FROM Player_Data WHERE username = '%s' AND password = '%s'", PlayerName(playerid), password);
mysql_query(query);
mysql_store_result();
mysql_retrieve_row();
{
if(mysql_fetch_field_row (data, "password"))
{
{
mysql_fetch_field_row(data, "adminlvl");
UserInfo[playerid][Admin] = strval(data);
mysql_fetch_field_row(data, "registration_date");
UserInfo[playerid][Registration_Date] = strval(data);
mysql_fetch_field_row(data, "registration_time");
UserInfo[playerid][Registration_Time] = strval(data);
mysql_fetch_field_row(data, "last_seen");
UserInfo[playerid][LastSeen] = strval(data);
mysql_fetch_field_row(data, "ip");
UserInfo[playerid][IP] = strval(data);
mysql_fetch_field_row(data, "caradmin");
UserInfo[playerid][Caradmin] = strval(data);
mysql_fetch_field_row(data, "cash");
UserInfo[playerid][Cash] = strval(data);
mysql_fetch_field_row(data, "score");
UserInfo[playerid][Score] = strval(data);
mysql_fetch_field_row(data, "banned");
UserInfo[playerid][Banned] = strval(data);
mysql_fetch_field_row(data, "vehicleid");
UserInfo[playerid][Vehicle] = strval(data);
mysql_fetch_field_row(data, "warnings");
UserInfo[playerid][Warnings] = strval(data);
mysql_fetch_field_row(data, "kicks");
UserInfo[playerid][Kicks] = strval(data);
mysql_fetch_field_row(data, "tempbans");
UserInfo[playerid][Tempbans] = strval(data);
mysql_fetch_field_row(data, "punishments");
UserInfo[playerid][Punishments] = strval(data);
mysql_fetch_field_row(data,"totalpunishments");
UserInfo[playerid][tPunishments] = strval(data);
}
SetPVarInt(playerid, "Popup.Login", 0);
UserInfo[playerid][Logged] = 1;
GivePlayerMoney(playerid, UserInfo[playerid][Cash]);
SetPlayerScore(playerid, UserInfo[playerid][Score]);
DeletePVar(playerid, "Popup.Login");
}
else
{
PassFail[playerid]++;
if(GetPVarInt(playerid, "PassAttempt") != 3)
{
switch(PassFail[playerid])
{
case 1:
{
ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_INPUT, "Login", "Incorrect password, you have 2 attempts left out of 3", "Login", "Quit");
}
case 2:
{
ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_INPUT, "Login", "Incorrect password, you have 1 attempt left out of 3", "Login", "Quit");
}
case 3:
{
SendClientMessage(playerid, COLOR_CYAN,"You have failed to login, you are now kicked");
Kick(playerid);
return 1;
}
}
return 1;
}
mysql_free_result();
return 1;
}
}
SetPVarInt(playerid, "Admin", UserInfo[playerid][Admin]);
GetPlayerIp(playerid, ip, 20);
format(str, sizeof str, "You are logged in!", name);
SendClientMessage(playerid, COLOR_GREEN, str);
printf("[part] %s has logged in", name);
if (UserInfo[playerid][Caradmin] == 1)
{
format(str, sizeof str, "Welcome back, Vehicle Administrator");
SendClientMessage(playerid, COLOR_LIGHTYELLOW, str);
}
if (UserInfo[playerid][Admin] == 1)
{
format(str, sizeof str, "Welcome back, Moderator!");
SendClientMessage(playerid, COLOR_LIGHTYELLOW, str);
}
if (UserInfo[playerid][Admin] == 2)
{
format(str, sizeof str, "Welcome back, Administrator!");
SendClientMessage(playerid, COLOR_LIGHTYELLOW, str);
}
if (UserInfo[playerid][Admin] == 3)
{
format(str, sizeof str, "Welcome back, Manager!");
SendClientMessage(playerid, COLOR_LIGHTYELLOW, str);
}
if (UserInfo[playerid][Admin] == 4)
{
format(str, sizeof str, "Welcome back, Developer!");
SendClientMessage(playerid, COLOR_LIGHTYELLOW, str);
}
if (UserInfo[playerid][Admin] == 5)
{
format(str, sizeof str, "Welcome back, Leader!");
SendClientMessage(playerid, COLOR_LIGHTYELLOW,str);
}
CreateRecordFile(playerid);
if(strlen(dini_Get("aliases/alias.txt", ip)) == 0)
{
dini_Set("aliases/alias.txt", ip, name);
}
else
{
if( strfind( dini_Get("Aliases/alias.txt", ip), name, true) == -1 )
{
format(str,sizeof(str),"%s, %s", dini_Get("Aliases/alias.txt",ip), name);
dini_Set("Aliases/alias.txt", ip, str);
}
}
}
StopAudioStreamForPlayer(playerid);
return 1;
}