27.02.2010, 22:23
Heres my code: Of SeifAdmin
As you see at the bottom of that code is
Well it turns of spectating but it dosent spawn me, Why?
pawn Код:
public OnPlayerLogin(playerid, password[])
{
new name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "/Roleplay/%s.cfg", name);
new File:account = fopen(str, io_read);
if (account)
{
new pass[256];
new passres[256], value[256];
fread(account, pass, sizeof pass);
passres = GetFileString(pass);
if (!strcmp("Password", passres))
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][Password], value, 0, strlen(value), 150);
}
if (!strcmp(AccountInfo[playerid][Password], password, true))
{
while (fread(account, pass, 256))
{
passres = GetFileString(pass);
if (!strcmp("AdminLevel", passres, true))
{
value = GetFileValue(pass);
AccountInfo[playerid][AdminLevel] = strval(value);
}
if (!strcmp("Cash", passres, true))
{
value = GetFileValue(pass);
AccountInfo[playerid][Cash] = strval(value);
}
if (!strcmp("Score", passres, true))
{
value = GetFileValue(pass);
AccountInfo[playerid][Score] = strval(value);
}
if (!strcmp("Warnings", passres, true))
{
value = GetFileValue(pass);
AccountInfo[playerid][Warns] = strval(value);
}
if (!strcmp("WarnReason1", passres, true))
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason1], value, 0, strlen(value), 128);
}
if (!strcmp("WarnReason2", passres, true))
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason2], value, 0, strlen(value), 128);
}
if (!strcmp("WarnReason3", passres, true))
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][WarnReason3], value, 0, strlen(value), 128);
}
}
fclose(account);
AccountInfo[playerid][Logged] = 1;
}
else
{
SendClientMessage(playerid, RED, "Incorrect Password.");
fclose(account);
return 1;
}
GivePlayerMoney(playerid, AccountInfo[playerid][Cash]);
SetPlayerScore(playerid, AccountInfo[playerid][Score]);
format(str, sizeof str, "|- You have successfully logged in as %s -|", name);
SendClientMessage(playerid, GREEN, str);
printf("%s has logged in", name);
TogglePlayerSpectating(playerid, 0);
SpawnPlayer(playerid);
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;
}
pawn Код:
TogglePlayerSpectating(playerid, 0);
SpawnPlayer(playerid);