[SOLVED]need help with login
#1

hello,i got prob,im using seifs admin and if i spawn without login i still can play,can anybody know how to fix this? thanks guys
http://forum.sa-mp.com/index.php?topic=40940.0

Quote:

public OnPlayerLogin(playerid, password[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "/sAccounts/%s.seifadmin", name);
new File:account = fopen(str, io_read);
if (account)
{
new pass[256];
new passres[128], value[128];
fread(account, pass, sizeof pass);
passres = GetFileString(pass);
if (!strcmp("Password", passres))
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][Password], value, 0, strlen(value)-1, 12;
}
if (!strcmp(AccountInfo[playerid][Password], password, true))
{
while (fread(account, pass, 256))
{
passres = GetFileString(pass);
if (strfind(passres, "AdminLevel") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][AdminLevel] = strval(value);
}
if (strfind(passres, "Cash") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][Cash] = strval(value);
}
if (strfind(passres, "Warnings") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][Warns] = strval(value);
}
if (strfind(passres, "WarnReason1") != -1)
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason1], value, 0, strlen(value)-1, 12;
}
if (strfind(passres, "WarnReason2") != -1)
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason2], value, 0, strlen(value)-1, 12;
}
if (strfind(passres, "WarnReason3") != -1)
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason3], value, 0, strlen(value)-1, 12;
}
}
fclose(account);
AccountInfo[playerid][Logged] = 1;
}
else
{
SendClientMessage(playerid, RED, "Incorrect Password.");
fclose(account);
return 1;
}
GivePlayerMoney(playerid, AccountInfo[playerid][Cash]);
format(str, sizeof str, "|- You have successfully logged in as %s -|", name);
SendClientMessage(playerid, GREEN, str);
printf("%s has logged in", name);
if (AccountInfo[playerid][AdminLevel] > 0)
{
format(str, sizeof str, "|» You are now logged in as a level %d admin «|", AccountInfo[playerid][AdminLevel]);
SendClientMessage(playerid, LIGHTGREEN, str);
ViewCmds[playerid] = 0;
}
}
return 1;
}

Reply
#2

you can freeze the player if he's not logged in by using "TogglePlayerControllable(playerid, false);"
Reply
#3

but thats the problem,where i add this? i would add some kick thing to there but i dont know where sorry for being dumb

NVM:GOT IT!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)