05.08.2010, 10:31
The gamemode doesn't connect to the MYSQL database. It showed that it does connect, but look at the next problem:
When I ingame, it tells me to /login. Even if I'm not registered, it still tells me to login. It should tell me to go to the ucp bla bla bla.. but no. And when I try to /login, no mater whatt password I use, it drops me in the midle of nowhere, and set my stats all to 0. Same happens when I am registered. I've created an account for myself via the database editor (Nevicat for MySql), and I do have an account, but the same things happens..
This is my /login CMD:
OnPlayerConnect:
Does someone knows what is the problem now?
Thank you.
When I ingame, it tells me to /login. Even if I'm not registered, it still tells me to login. It should tell me to go to the ucp bla bla bla.. but no. And when I try to /login, no mater whatt password I use, it drops me in the midle of nowhere, and set my stats all to 0. Same happens when I am registered. I've created an account for myself via the database editor (Nevicat for MySql), and I do have an account, but the same things happens..
This is my /login CMD:
Код:
dcmd_login(playerid, params[]) { if(playerinfo[playerid][login]) { SendClientMessage(playerid, COLOR_RED, "Error: You are already logged in!"); return 1; } if(!strlen(params)) { SendClientMessage(playerid,COLOR_GREY,"USAGE: /login [password]"); return 1; } if(playerinfo[playerid][uid]==-1) { return SendClientMessage(playerid,COLOR_GREY,"Please, register first!"); } format(stringEX,MAX_STRING1,"`id`='%d'",playerinfo[playerid][uid]); mysql_GetStr("users","pass",stringEX); if(!strcmp(String,params,false)) { format(stringEX,MAX_STRING1,"Welcome back %s!",playerinfo[playerid][playername]); SendClientMessage(playerid,COLOR_LIGHTYELLOW,stringEX); LoadFromMysql(playerid); playerinfo[playerid][login]=4*60; playerinfo[playerid][updatereduce]=30; getdate(yearEX,monthEX,dayEX); gettime(hourEX,minEX,secEX); format(queryEX, 256, "UPDATE `users` SET `timestamp`='%d/%d/%d - %d:%d:%d' WHERE `id`='%d' LIMIT 1;",yearEX,monthEX,dayEX,hourEX,minEX,secEX,playerinfo[playerid][uid]); mysql_query(queryEX); for(new i = 0; i < MAX_PLAYERS+1; i++) { if(IsPlayerConnected(i)) { if(IsPlayerInAnyVehicle(i)) { if(tints[GetPlayerVehicleID(i)]) { if(!playerinfo[playerid][admin]) { ShowPlayerNameTagForPlayer(playerid, i, 0); } else { SetPlayerMarkerForPlayer(playerid, i, COLOR_BLUE); } } } } } TogglePlayerSpectating(playerid, 0); AntiHax[playerid][TpX] = 0; AntiHax[playerid][TpY] = 0; AntiHax[playerid][TpZ] = 0; SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); AntiHax[playerid][TpX] = 0; AntiHax[playerid][TpY] = 0; AntiHax[playerid][TpZ] = 0; SetPlayerSkin(playerid,playerinfo[playerid][skin]); SetPlayerScore(playerid,1); return 1; } else { playerinfo[playerid][Try]++; format(stringEX,MAX_STRING1,"Wrong password (%d/3)!",playerinfo[playerid][Try]); SendClientMessage(playerid,COLOR_RED,stringEX); if(playerinfo[playerid][Try]==3) { SendClientMessage(playerid,COLOR_RED,"You have tried three times. You have been kicked from the server."); Kick(playerid); } return 1; } }
Код:
PlayerPlaySound(playerid, 1185, 0.0, 0.0, 0.0); TogglePlayerSpectating(playerid, 1); ResetPlayer(playerid); #if DEBUG 1 format(debugs,256,"DEBUG | OnPlayerConnect(%s) start.",playerinfo[playerid][playername2]); debugLog(debugs); #endif GiveMoney(playerid,1000); SetPlayerColor(playerid,COLOR_INV); GetPlayerIp(playerid,playerinfo[playerid][IP],15); new string[MAX_STRING1]; format(string,256,"`name`='%s'",playerinfo[playerid][playername2]); mysql_GetInt("users","id", playerinfo[playerid][uid], string); for(new i=0;i<11;i++) { SendClientMessage(playerid,COLOR_LIGHTYELLOW," "); } if(playerinfo[playerid][uid]==-1) { GameTextForPlayer(playerid,"Register at: ~n~~y~http://www.ucp.exodus-roleplay.net",500000,5); SendClientMessage(playerid,COLOR_LIGHTRED,"Register at: http://www.ucp.exodus-roleplay.net"); Kick(playerid); } else { SendClientMessage(playerid,COLOR_WHITE,"SERVER: In order to login do /login [password]"); } if(!ValidName(playerinfo[playerid][playername2])) { format(string,MAX_STRING1,"SERVER: Format: Firstname_Lastname. Really simple, roleplay name format."); SendClientMessage(playerid,COLOR_RED,string); Kick(playerid); } else { for(new i=0;i<strlen(playerinfo[playerid][playername]);i++) { if(playerinfo[playerid][playername][i]=='_') { playerinfo[playerid][playername][i]=' '; } } } new hour,mins,sec,day,month,year; gettime(hour,mins,sec); getdate(year,month,day); format(string,MAX_STRING1,"%s has joined the server (%d:%d:%d %d/%d/%d %s)",playerinfo[playerid][playername],hour,mins,sec,day,month,year,playerinfo[playerid][IP]); Log("inout.txt",string); PMAllowed[playerid] = true; #if DEBUG 1 format(debugs,256,"DEBUG | OnPlayerConnect(%s) end.",playerinfo[playerid][playername2]); debugLog(debugs); #endif return 1; }
Thank you.