SA-MP Forums Archive
[SOLVED]need help with login - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED]need help with login (/showthread.php?tid=91018)



[SOLVED]need help with login - WardenCS - 11.08.2009

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;
}




Re: need help with login - James_Alex - 11.08.2009

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


Re: need help with login - WardenCS - 11.08.2009

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!