Несохронает аккаунти в бд MySQL R39 - Форум Cheat-Master.ru
  • Страница 1 из 1
  • 1
Модератор форума: [CM]OlegEhtler, Getbackthere, Phoenixxx_Czar  
Несохронает аккаунти в бд MySQL R39
GhettoGG Дата: Среда, 31.07.2019, 15:05 | Сообщение # 1
Новичок
Сообщений: 1
Статус: Offline
Здрастье! Я писал мод с нуля и дошол до этого шо мне несохронается акаунты! Я уже ранше пытался писать мод с нуля(несколко раз) но таже проблема шо несохронает ранше я исползывал denwer но она баголась и вообще неподклучилась! Сейчас я исползывал OpenServer c ним мне бд подключалась!
1. MySQL LOGS нету!
2. код мода!
// ADVANCED BY GHETTO v0.07
// ============================== [ INCLUDE ] ==============================
#include <a_samp>
#include <a_mysql>
#include <foreach>
#include <mxdate>
#include <Pawn.CMD>
#include <sscanf2>
#include <streamer>
// ============================== [ Data Base ] ==============================
#define SQL_HOST "localhost"
#define SQL_USER "root"
#define SQL_DB "advanced"
#define SQL_PASS ""
// ============================== [ COLORS ] ==============================
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_GREY 0x9A9A9AFF
#define COLOR_RED 0xAA3333AA
// ============================== [ DEFINE ] ==============================
#define gamemode_text "advanced-rp v0.07"
#define NameServer "Advanced Role Play"
#define sendername(%0) player[%0][pname]
#define SCM SendClientMessage
#define SPD ShowPlayerDialog
#define DSI DIALOG_STYLE_INPUT
#define DSM DIALOG_STYLE_MSGBOX
#define DSL DIALOG_STYLE_LIST
#define Tkick(%0) SetTimerEx("@_TimeKick", 50, false, "i", %0)
#define Freeze(%0,%1) TogglePlayerControllable(%0, %1)
// ============================== [ Masоvi ] ==============================
// peremenaya
new connect_mysql;
// masоvi
new number_skin[MAX_PLAYERS char],

update_timer[MAX_PLAYERS],

Text: td_select_skin[MAX_PLAYERS][3],

bool: login_check[MAX_PLAYERS char];


enum pInfo {
pname[MAX_PLAYER_NAME+1], ppass[32+1], pmail[60+1], pmoney, psex, pskin, page, pnations, plevel, pid, preferal_check, preferal[MAX_PLAYER_NAME+1]
}
new player[MAX_PLAYERS][pInfo];
// ============================== [ PUBLIC ] ==============================
public OnGameModeInit()
{
SetGameModeText(gamemode_text);
AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
ShowPlayerMarkers(PLAYER_MARKERS_MODE_STREAMED);
ShowNameTags(true);
SetNameTagDrawDistance(20.0);
DisableInteriorEnterExits();
EnableStuntBonusForAll(0);
connect_mysql = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
mysql_function_query(connect_mysql, "SET NAMES utf8", false, "", "");
mysql_function_query(connect_mysql, "SET CHARACTER SET 'cp1251'", false, "", "");
return true;
}
public OnGameModeExit()
{
return true;
}
public OnPlayerRequestClass(playerid, classid)
{
return true;
}
public OnPlayerConnect(playerid)
{
GetPlayerName(playerid, player [playerid][pname], MAX_PLAYER_NAME);
static
fmt_str[] = "SELECT * FROM `accounts` WHERE `Name` = '%s'";
new string[sizeof(fmt_str)+MAX_PLAYER_NAME-1];
mysql_format(connect_mysql, string, sizeof(string), fmt_str, sendername(playerid));
mysql_function_query(connect_mysql, fmt_str, true, "@_PlayerCheck", "d", playerid);
Clear(playerid);
PlayerTextDraws(playerid);
return true;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimers(playerid);
return true;
}
public OnPlayerSpawn(playerid)
{
if(login_check{playerid} == true)
SetPlayerSpawn(playerid);

return true;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return true;
}
public OnVehicleSpawn(vehicleid)
{
return true;
}
public OnVehicleDeath(vehicleid, killerid)
{
return true;
}
public OnPlayerText(playerid, text[])
{
if(login_check{playerid} == false)
{
SCM(playerid, COLOR_GREY, !"Jыs neesat autorizзjies!");
return false;
}
return false;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
return false;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return true;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return true;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return true;
}
public OnPlayerEnterCheckpoint(playerid)
{
return true;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return true;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return true;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return true;
}
public OnRconCommand(cmd[])
{
return true;
}
public OnPlayerRequestSpawn(playerid)
{
return false;
}
public OnObjectMoved(objectid)
{
return true;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return true;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return true;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return true;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return true;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return true;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return true;
}
public OnPlayerExitedMenu(playerid)
{
return true;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return true;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return true;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return true;
}
public OnPlayerUpdate(playerid)
{
return true;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return true;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return true;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return true;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return true;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 1:
{
if(response)
{
new len = strlen(inputtext);
if(!len)
{
SCM(playerid, COLOR_GREY, !"Jыs neko neievadijвt.");
DialogRegistration(playerid);
return true;
}
if(len < 4 || len > 32)
{
SCM(playerid, COLOR_GREY, !"Parolei jвsastвv no 4 lоdz 32 simboliem!");
DialogRegistration(playerid);
return true;
}
for(new i = len; i != 0; --i)
switch(inputtext[i])
{
case 'А'..'Я', 'а'..'я':
{
SCM(playerid, COLOR_GREY, !"Parolei jвsastвv no latvieрu burtiem.");
DialogRegistration(playerid);
return true;
}
}
strmid(player[playerid][ppass], inputtext, 0, len, 32+1);
DialogEmail(playerid);
}
else
{
SCM(playerid, COLOR_LIGHTRED, !"Jums ir jвautorizзjas! Lai izietu no spзles, ievadiet: {ffffff}/q(uit)");
Tkick(playerid);
}
}
case 2:
{
if(response)
{
new len = strlen(inputtext);
if(!len)
{
SCM(playerid, COLOR_GREY, !"Jыs neko neievadijвt!.");
DialogEmail(playerid);
return true;
}
if(len > 60)
{
SCM(playerid, COLOR_GREY, !"Jums ir jвizmanto оstв e-mail adrese!");
DialogEmail(playerid);
return true;
}
if(strfind(inputtext, "@", false) == -1 || strfind(inputtext, ".", false) == -1)
{
SCM(playerid, COLOR_GREY, !"Jums ir jвizmanto оstв e-mail adrese!");
DialogEmail(playerid);
return true;
}

for(new i = len; i != 0; --i)
switch(inputtext[i])
{
case 'А'..'Я', 'а'..'я':
{
SCM(playerid, COLOR_GREY, !"E-Mail'am jвsastвv no latvieрu burtiem.");
DialogEmail(playerid);
return true;
}
}
strmid(player[playerid][pmail], inputtext, 0, len, 60+1);
DialogNations(playerid);
}
else
DialogRegistration(playerid);
}
case 3:
{
if(response)
{
player[playerid][pnations] = listitem+1;
DialogAge(playerid);
}
else
DialogEmail(playerid);
}
case 4:
{
if(response)
{
new val = strval(inputtext);
if(!strlen(inputtext))
{
SCM(playerid, COLOR_GREY, !"Jыs neko neievadijвt.");
DialogRegistration(playerid);
return true;
}
if(val < 18 || val > 80)
{
SCM(playerid, COLOR_GREY, !"Vadiet augumu no 18 lоdz 80!");
DialogAge(playerid);
return true;
}
player[playerid][page] = val;
DialogReferal(playerid);
}
else
DialogNations(playerid);
}
case 5:
{
if(response)
{
if(!strlen(inputtext))
{
SCM(playerid, COLOR_GREY, !"Jыs neko neievadijвt.");
DialogReferal(playerid);
return true;
}
static
fmt_str[] = "SELECT * FROM `accounts` WHERE `Name` = '%s'";
new string[sizeof(fmt_str)+MAX_PLAYER_NAME-1];
mysql_format(connect_mysql, string, sizeof(string), fmt_str, (inputtext));
mysql_function_query(connect_mysql, fmt_str, true, "@_CheckReferal", "ds", playerid, inputtext);
}
else
{
strmid(player[playerid][preferal], "None", 0, strlen("None"), 4+1);
DialogSex(playerid);
}
}
case 6:
{
SpawnPlayer(playerid);
if(response)
{
player[playerid][psex] = 1;
SetPlayerSkin(playerid, 78);
number_skin{playerid} = 1 ;
}
else
{
player[playerid][psex] = 2;
SetPlayerSkin(playerid, 10);
number_skin{playerid} = 11;
}

for(new i; i != 3; i++) TextDrawShowForPlayer(playerid, td_select_skin[playerid][i]);
SelectTextDraw(playerid, 0xFF0000FF);
SetPlayerVirtualWorld(playerid, playerid);
SetPlayerInterior(playerid, 5);
SetPlayerPos(playerid, 226.3548,-8.1306,1002.2109);
SetPlayerFacingAngle(playerid, 90.4092);
SetPlayerCameraPos(playerid, 221.8495,-8.1760,1002.2109);
SetPlayerCameraLookAt(playerid, 226.3548,-8.1306,1002.2109);
Freeze(playerid, 0);
}
}
return true;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return true;
}
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
if(login_check{playerid} == false)
{
SCM(playerid, COLOR_GREY, !"Jыs neesat autorizзjies!");
return false;
}

return false;
}
public OnPlayerClickTextDraw(playerid, Text: clickedid)
{
if(clickedid == Text:INVALID_TEXT_DRAW && number_skin{playerid} > 0)
SelectTextDraw(playerid, 0xFF0000FF);
if(clickedid == td_select_skin[playerid][0])
{
number_skin{playerid} ++;
if(player[playerid][psex] == 1)
{
if(number_skin{playerid} == 11)
number_skin{playerid} = 1;
}
else
{
if(number_skin{playerid} == 24)
number_skin{playerid} = 11;
}

switch(number_skin{playerid})
{
// puisu
case 1: SetPlayerSkin(playerid, 78);
case 2: SetPlayerSkin(playerid, 79);
case 3: SetPlayerSkin(playerid, 134);
case 4: SetPlayerSkin(playerid, 135);
case 5: SetPlayerSkin(playerid, 136);
case 6: SetPlayerSkin(playerid, 137);
case 7: SetPlayerSkin(playerid, 160);
case 8: SetPlayerSkin(playerid, 200);
case 9: SetPlayerSkin(playerid, 212);
case 10: SetPlayerSkin(playerid, 230);
// meitenu
case 11: SetPlayerSkin(playerid, 10);
case 12: SetPlayerSkin(playerid, 39);
case 13: SetPlayerSkin(playerid, 54);
case 14: SetPlayerSkin(playerid, 75);
case 15: SetPlayerSkin(playerid, 77);
case 16: SetPlayerSkin(playerid, 89);
case 17: SetPlayerSkin(playerid, 129);
case 18: SetPlayerSkin(playerid, 130);
case 19: SetPlayerSkin(playerid, 196);
case 20: SetPlayerSkin(playerid, 197);
case 21: SetPlayerSkin(playerid, 199);
case 22: SetPlayerSkin(playerid, 218);
case 23: SetPlayerSkin(playerid, 232);
}
}
if(clickedid == td_select_skin[playerid][1])
{
number_skin{playerid} --;
if(player[playerid][psex] == 1)
{
if(number_skin{playerid} == 0)
number_skin{playerid} = 10;
}
else
{
if(number_skin{playerid} == 10)
number_skin{playerid} = 23;
}

switch(number_skin{playerid})
{
// puisu
case 1: SetPlayerSkin(playerid, 78);
case 2: SetPlayerSkin(playerid, 79);
case 3: SetPlayerSkin(playerid, 134);
case 4: SetPlayerSkin(playerid, 135);
case 5: SetPlayerSkin(playerid, 136);
case 6: SetPlayerSkin(playerid, 137);
case 7: SetPlayerSkin(playerid, 160);
case 8: SetPlayerSkin(playerid, 200);
case 9: SetPlayerSkin(playerid, 212);
case 10: SetPlayerSkin(playerid, 230);
// meitenu
case 11: SetPlayerSkin(playerid, 10);
case 12: SetPlayerSkin(playerid, 39);
case 13: SetPlayerSkin(playerid, 54);
case 14: SetPlayerSkin(playerid, 75);
case 15: SetPlayerSkin(playerid, 77);
case 16: SetPlayerSkin(playerid, 89);
case 17: SetPlayerSkin(playerid, 129);
case 18: SetPlayerSkin(playerid, 130);
case 19: SetPlayerSkin(playerid, 196);
case 20: SetPlayerSkin(playerid, 197);
case 21: SetPlayerSkin(playerid, 199);
case 22: SetPlayerSkin(playerid, 218);
case 23: SetPlayerSkin(playerid, 232);
}
}
if(clickedid == td_select_skin[playerid][2])
{
for(new i; i != 3; i++) TextDrawHideForPlayer(playerid, td_select_skin[playerid][i]);
SCM(playerid, COLOR_WHITE, !"Jыs pieregistrзjвt akontu");
login_check{playerid} = true;
update_timer[playerid] = SetTimerEx("@_UpdateTime", 1_000, false, "i", playerid);
Freeze(playerid, 1);
number_skin{playerid} = 0;
CancelSelectTextDraw(playerid);
// ACC IZVEIDE
player[playerid][plevel] = 1;
player[playerid][pmoney] = 0;
player[playerid][pskin] = GetPlayerSkin(playerid);
//
static
fmt_str[] = "ISERT INTO `accounts` (`Name`, `Pass`, `Mail`, `Sex`, `Skin`, `Age`, `Nations`, `Level`, Referal, `ReferalCheck`) VALUES ('%s, '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%d')",
fmt_str_2[] = "SELECT * FROM `accounts` WHERE `Name` = '%s'";

new string[sizeof(fmt_str)+MAX_PLAYER_NAME*2+85],
string_2[sizeof(fmt_str_2)+MAX_PLAYER_NAME-1];

mysql_format(connect_mysql, string, sizeof(string), fmt_str, player[playerid][pname], player[playerid][ppass], player[playerid][pmail], player[playerid][psex], player[playerid][pskin], player[playerid][page], player[playerid][pnations], player[playerid][plevel], player[playerid][preferal], player[playerid][preferal_check]);
mysql_format(connect_mysql, string_2, sizeof(string_2), fmt_str_2, player[playerid][pname]);
mysql_function_query(connect_mysql, string, true, "", "");
mysql_function_query(connect_mysql, string_2, true, "@_GetID", "i", playerid);
SpawnPlayer(playerid);
}
return true;
}

@_PlayerCheck(playerid);
@_PlayerCheck(playerid)
{
new
rows,
fields;
cache_get_data(rows, fields);
if(rows)
{
// Autorizвcija
}
else
DialogRegistration(playerid);

SCM(playerid, COLOR_WHITE, !"Laipni lыgti iekр:{4BE1FF} SAMP ARP.ITP.LV");
return true;
}
@_UpdateTime(playerid);
@_UpdateTime(playerid)
{
if(player[playerid][pmoney] != GetPlayerMoney(playerid))
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, player[playerid][pmoney]);
}
update_timer[playerid] = SetTimerEx("@_UpdateTime", 1_000, false, "i", playerid);
return true;
}
@_TimeKick(playerid);
@_TimeKick(playerid)
{
Kick(playerid);
return true;
}
@_CheckReferal(playerid, name[]);
@_CheckReferal(playerid, name[])
{
new
rows,
fields;

cache_get_data(rows, fields);
if(!rows)
{
SCM(playerid, COLOR_GREY, !"Konts Datu bвzз netika atrasts.");
DialogReferal(playerid);
return true;
}

player[playerid][preferal_check] = 1;
strmid(player[playerid][preferal], name, 0, strlen(name), MAX_PLAYER_NAME+1);
DialogSex(playerid);
return true;
}
@_GetID(playerid);
@_GetID(playerid)
{
new
rows,
fields;

cache_get_data(rows, fields);
if(rows)
{
player[playerid][pid] = cache_get_field_content_int(0, "ID");
}
return true;
}
// ============================== [ STOCK ] ==============================
stock Clear(playerid)
{
number_skin{playerid} = 0;
login_check{playerid} = false;
}
stock DialogRegistration(playerid)
{
static const
fmt_str[] = "{ffffff}Laipni lыdzam uz {0080FF}"NameServer" {ffffff}\nEsiet sveicinвts/-a - {0080FF}%s{ffffff} ,izskatвs ka nзesat reмistrзjuрies!{ffffff}\nIevadiet рeit savu jauno paroli no profila:";
new string[sizeof(fmt_str)+MAX_PLAYER_NAME-1];
format(string, sizeof(string), fmt_str, sendername(playerid));
SPD(playerid, 1, DSI, "Reмistrвcija", string, "Tвlвk", "Atcelt");
}
stock DialogEmail(playerid)
{
SPD(playerid, 2, DSI, !"E-Mail", "{ffffff}Ievadiet savu e-pasta adresi:\n\n{ffffff}Ja aizmirsоsiet savu paroli\n{ffffff}Jыsu varзsiet to atgыt ar e-pasta palоdzоbu!", "Tвlвk", "Atpakaп");
}
stock DialogNations(playerid)
{
SPD(playerid, 3, DSL, !"Nacional", "{FFFFFF}-Latvietis\n-Krievs\n-Amerikвnis\n-Japвnis\n-Ноnietis", "Tвlвk", "Atpakaп");
}
stock DialogAge(playerid)
{
SPD(playerid, 4, DSI, "Vecums", "{FFFFFF}Ievadiet savu vecumu\nVecums no 18 lоdz 80", "Tвlвk", "Atpakaп");
}
stock DialogReferal(playerid)
{
SPD(playerid, 5, DSI, "Referal", "{FFFFFF}Ievadiet drauga spзles vвrdu!\nKad jыs sasniegsiet 4lvl, jыs saтemsiet 50.000$!", "Tвlвk", "Izlaist");
}
stock DialogSex(playerid)
{
SPD(playerid, 6, DSM, "Sex", "{FFFFFF}Izvзlieties dzimumu:", "Vоrietis", "Sieviete");
}
stock PlayerTextDraws(playerid)
{
// Skin izvзle
td_select_skin[playerid][0] = TextDrawCreate(534.582580, 303.333221, "LD_BEAT:right");
TextDrawLetterSize(td_select_skin[playerid][0], 0.000000, 0.000000);
TextDrawTextSize(td_select_skin[playerid][0], 67.935607, 37.916625);
TextDrawAlignment(td_select_skin[playerid][0], 2);
TextDrawColor(td_select_skin[playerid][0], -5963521);
TextDrawSetShadow(td_select_skin[playerid][0], 0);
TextDrawSetOutline(td_select_skin[playerid][0], 0);
TextDrawBackgroundColor(td_select_skin[playerid][0], -5963521);
TextDrawFont(td_select_skin[playerid][0], 4);
TextDrawSetSelectable(td_select_skin[playerid][0], true);

td_select_skin[playerid][1] = TextDrawCreate(30.985092, 303.750091, "LD_BEAT:left");
TextDrawLetterSize(td_select_skin[playerid][1], 0.000000, 0.000000);
TextDrawTextSize(td_select_skin[playerid][1], 67.935607, 37.916625);
TextDrawAlignment(td_select_skin[playerid][1], 2);
TextDrawColor(td_select_skin[playerid][1], -5963521);
TextDrawSetShadow(td_select_skin[playerid][1], 0);
TextDrawSetOutline(td_select_skin[playerid][1], 0);
TextDrawBackgroundColor(td_select_skin[playerid][1], -5963521);
TextDrawFont(td_select_skin[playerid][1], 4);
TextDrawSetSelectable(td_select_skin[playerid][1], true);

td_select_skin[playerid][2] = TextDrawCreate(320.266571, 313.249938, "SELECT");
TextDrawLetterSize(td_select_skin[playerid][2], 0.449999, 1.600000);
TextDrawTextSize(td_select_skin[playerid][2], 12.935607, 65.916625);
TextDrawAlignment(td_select_skin[playerid][2], 2);
TextDrawColor(td_select_skin[playerid][2], -5963521);
TextDrawSetShadow(td_select_skin[playerid][2], 0);
TextDrawSetOutline(td_select_skin[playerid][2], 2);
TextDrawBackgroundColor(td_select_skin[playerid][2], 255);
TextDrawFont(td_select_skin[playerid][2], 2);
TextDrawSetProportional(td_select_skin[playerid][2], 2);
TextDrawSetSelectable(td_select_skin[playerid][2], true);
}
stock SetPlayerSpawn(playerid)
{
SetPlayerColor(playerid, 0xFFFFFF00);
SetPlayerScore(playerid, player[playerid][plevel]);
SetPlayerSkin(playerid, player[playerid][pskin]);
SetPlayerPos(playerid, 1154.3717, -1769.2594, 16.5938);
SetPlayerFacingAngle(playerid, 0.0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
SetCameraBehindPlayer(playerid);
}
stock KillTimers(playerid)
{
KillTimer(update_timer[playerid]);
}
// ============================== [ SERVERA CMD ] ==============================
// ============================== [ OTHER] ==============================
main()
{
print(" ");
print("============================");
print("=== [GAMEMODE by GHETTO] ===");
print("============================");
print(" ");
if(mysql_errno()) print(" Savienojums ar Datu bвzi MySQL; (advanced) notika NEveiksmоgi!");
else print(" Savienojums ar Datu bвzi MySQL; (advanced) notika veiksmоgi!");
print("----------------------------------\n");
}
3.Бд http://prntscr.com/omgk3f
Я чесно непонемаю почему несохронает! Помогите кто может И извените за ошибки я не руский! Так-же мод написан в моем радном языке
Iacoste Дата: Пятница, 02.08.2019, 13:01 | Сообщение # 2
Боец
Сообщений: 101
Статус: Offline
Если было бы по Русский, я бы помог

Lacoste za, net lacoste protiiiv
[CM]MaTaS Дата: Воскресенье, 15.03.2020, 00:27 | Сообщение # 3
Боец
Сообщений: 76
Статус: Offline
в oNplayerdisconnect засунь сохранение попробуй
  • Страница 1 из 1
  • 1
Поиск:
Статистика Форума