public OnPlayerConnect(playerid) { new playrname[MAX_PLAYER_NAME]; new PlayerName[30], str[256]; GetPlayerName(playerid, PlayerName, 30); format(str, 256, "%s has joined the server!", PlayerName); SendClientMessageToAll(0xFF9900AA, str); GameTextForPlayer(playerid,"~w~SA-MP: ~r~El Blanco's ~g~TDM",5000,5); SendPlayerFormattedText(playerid, "Welcome to El blanco's Team-Deathmatch, For more info type /help.", 0); SendClientMessage(playerid, 0xAA3333AA, "Pay us a visit at http://eb.sa-mp-league.com!! Mess with the best . . .!"); gActivePlayers[playerid]++; gLastGaveCash[playerid] = GetTickCount(); playerCheckpoint[playerid]=999; bank[playerid]=0; playerGang[playerid]=0; gangInvite[playerid]=0; GetPlayerName(playerid, playrname, sizeof(playrname)); for(new i = 0; i < MAX_SAVE; i++) { if(isStringSame(savedNames[i], playrname, MAX_PLAYER_NAME)) { GivePlayerMoney(playerid, savedInfo[i][0]); bank[playerid] = savedInfo[i][1]; bounty[playerid] = savedInfo[i][2]; savedInfo[i][0]=savedInfo[i][1]=savedInfo[i][2]=0; savedNames[i][0]=0; for(new j = 0; j < MAX_WEAPONS; j++) { playerWeapons[playerid][j]=savedWeapons[i][j]; savedWeapons[i][j]=0; } SendClientMessage(playerid, COLOR_GREEN, "Your money has been restored."); } } PLAYERLIST_authed[playerid]=false; return false; } public OnPlayerDisconnect(playerid) { new playername[MAX_PLAYER_NAME]; gActivePlayers[playerid]--; for(new i = 0; i < MAX_PROPERTIES; i++) { if(propertyOwner[i]==playerid) { propertyOwner[i] = 999; GivePlayerMoney(playerid, propertyValues[i]); } } //Save temp info for timeouts/crashes GetPlayerName(playerid, playername, sizeof(playername)); format(savedNames[savePos], MAX_PLAYER_NAME, "%s",playername); savedInfo[savePos][0] = GetPlayerMoney(playerid); savedInfo[savePos][1] = bank[playerid]; savedInfo[savePos][2] = bounty[playerid]; savedInfo[savePos][3] = 0; for(new i = 0; i < MAX_WEAPONS; i++) savedWeapons[savePos][i]=playerWeapons[playerid][i]; // savePos++; if(savePos >= MAX_SAVE) savePos = 0; PlayerLeaveGang(playerid); bounty[playerid] = 0; for(new i = 0; i < MAX_WEAPONS;i++) { playerWeapons[playerid][i]=0; } if (PLAYERLIST_authed[playerid]) { // Was loggedin, so save the data! dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid)); } PLAYERLIST_authed[playerid]=false; return false; } dcmd_register(playerid,params[]) { // The command shouldn't work if we already are authed if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Already authed."); // The command shouldn't work if an account with this // nick already exists if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account already exists, please use '/login password'."); // Did he forgot the password? if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/register password'"); // We save the money to the accstate if (udb_Create(PlayerName(playerid),params)) return SystemMsg(playerid,"Account successfully created. Login with '/login password' now."); return true; } /* * /login password * */ dcmd_login(playerid,params[]) { // The command shouldn't work if we already are authed if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Already authed."); // The command shouldn't work if an account with this // nick does not exists if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account doesn't exist, please use '/register password'."); // Did he forgot the password? if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/login password'"); if (udb_CheckLogin(PlayerName(playerid),params)) { // Login was correct // Following thing is the same like the missing SetPlayerCommand GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid)); PLAYERLIST_authed[playerid]=true; return SystemMsg(playerid,"Successfully authed!"); } else { // Login was incorrect return SystemMsg(playerid,"Login failed!"); } return true; } //----------------- //--------------------------------