12.05.2010, 00:58
im trying to make admin command of register user
but the command doesn't work i trying everything this is what i made
Can you help me and tell me what's wrong?
but the command doesn't work i trying everything this is what i made
Код:
if (strcmp(cmd, "/registeru", true) ==0 ) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pAdmin] >= 3) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/registeru [FullPlayerName] [Password]"); return 1; } format(string, sizeof(string), "%s.ini", tmp); new File: hFile = fopen(string, io_read); if (hFile) { SendClientMessage(playerid, COLOR_YELLOW, "That Username is already taken, please choose a different one."); fclose(hFile); return 1; } new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/registeru [FullPlayerName] [Password]"); return 1; } new tmppass[64]; strmid(tmppass, result, 0, strlen(cmdtext), 255); OnPlayerRegister(tmp,tmppass); return 1; } } }