new cmd[256]; new idx; cmd = strtok(cmdtext, idx); new tmp[256]; new playername[MAX_PLAYER_NAME]; new string[256]; new moneys; new giveplayer[MAX_PLAYER_NAME]; new giveplayerid; { if(IsPlayerConnected(playerid)) { new tmppass[64]; if(gPlayerInfo[playerid][PLAYER_LOGGED] == 1) { SendClientMessage(playerid, COLOUR_ORANGE, " You are already logged in."); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOUR_ORANGE, " USAGE: /login [password]"); return 1; } strmid(tmppass, tmp, 0, strlen(cmdtext), 255); Encrypt(tmppass); OnPlayerLogin(playerid,tmppass); } return 1; } }
if (strcmp(cmd, "/register", true)==0) { //new string[265]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /register [password]"); return 1; } if (gPlayerAccount[playerid] == 1) { SendClientMessage(playerid, COLOR_GREY, " That name is already registered"); return 1; } strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(cmdtext), 255); Encrypt(PlayerInfo[playerid][pPassword]); GetPlayerName(playerid, playername, sizeof(playername)); format(string, sizeof(string), "%s.cer", playername); new File: file = fopen(string, io_read); if (file) { SendClientMessage(playerid, COLOR_GREY, " That name is already registered"); fclose(file); return 1; } new File:hFile; hFile = fopen(string, io_append); new var[32];// format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var); format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var); format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var); PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid); format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var); format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var); fclose(hFile); SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!"); SendClientMessage(playerid, COLOR_WHITE, "Next time you connect, type /login <password> to log in."); OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]); return 1; }
Originally Posted by SA-MP Wiki
Change these to suit your server, but you will need to have these folders inside your server location's 'scriptfiles' folder:
Код:
"AdminScript/Users" "AdminScript/Settings" |