04.10.2010, 22:27
Hey Guys... Me Again xD... Im triying to learn MYSQL.... Im using G-sTyLeZzZ Plugin...
im having issues with a register command im triying to make... i have this....
The thing is... I was wondering.... Is there a way to avoid dual registry?... So people with the same name cant register?.... I have tried to register... after restarting the GM... an it creates the Player, but it increases the ID so...
im having issues with a register command im triying to make... i have this....
Код:
CMD:register(playerid,params[]) { new query[256]; if(isnull(params)) return SendClientMessage(playerid,COLOR_SERVER_WARNING,"[USAGE]: /REGISTER [PASSWORD]"); if(strlen(params) < 6) return SendClientMessage(playerid,COLOR_SERVER_WARNING,"[ERROR]: Password should contain at least 6 Characters!"); mysql_real_escape_string(params,params); format(query,sizeof(query),"INSERT INTO `%s` (Username,Password) VALUES ('%s',md5('%s'))",SQL_TABLE,PName(playerid),params); mysql_query(query); if(!IsPlayerConnected(playerid)) return AvoidSync(); mysql_store_result(); if(mysql_affected_rows()) { SendClientMessage(playerid,COLOR_SERVER,"Congratulations, You'r account is now registered!, Please Log In!"); PA[playerid][Registered] = true; } else { SendClientMessage(playerid,COLOR_SERVER_WARNING,"[ERROR]: Registration Failed!"); } return 1; }