23.07.2009, 06:56
If i do the command /login when i didnt register
its crash my samp server
Here is my /login and /register system:
its crash my samp server
Here is my /login and /register system:
Код:
//-------------------------------[Login]-------------------------------------------------------------------------- if (strcmp(cmd, "/login", true) ==0 || strcmp(cmd, "/l", true) == 0 ) { if(IsPlayerConnected(playerid)) { new tmppass[64]; if(gPlayerLogged[playerid] == 1) { SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You are already logged in."); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "USAGE: /login [password]"); return 1; } strmid(tmppass, tmp, 0, strlen(cmdtext), 255); //Encrypt(tmppass); OnPlayerLogin(playerid,tmppass); } return 1; } //-----------Register--------------- if (strcmp(cmd, "/register", true) ==0 ) { if(IsPlayerConnected(playerid)) { if(gPlayerLogged[playerid] == 1) { SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "SERVER: You are already logged in."); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); new namestring = strfind(sendername, "_", true); if(namestring == -1) { SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: Your name is not acceptable."); SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Hint: Your name must be in the format Firstname_Lastname."); Kick(playerid); return 1; } else { GetPlayerName(playerid, sendername, sizeof(sendername)); //format(string, sizeof(string), "%s.ini", sendername); new sqlaccountexists = MySQLCheckAccount(sendername); //new File: hFile = fopen(string, io_read); if (sqlaccountexists != 0) { SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "Immigration: There is already a citizen with that name."); //fclose(hFile); return 1; } new tmppass[64]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "USAGE: /register [password]"); return 1; } strmid(tmppass, tmp, 0, strlen(cmdtext), 255); //Encrypt(tmppass); OnPlayerRegister(playerid,tmppass); } } return 1; }