Question
#1

What is wrong in this?

Код:
public OnPlayerLogin(playerid, Pass[])
{
new Name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, Name, sizeof Name);
format(str, sizeof str,"/Accounts/%s.txt", Name);
new File:account = fopen(str, io_write);
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(AccInfo[playerid][password], value, 0, strlen(value)-1, 128);
}
if (!strcmp(AccInfo[playerid][password], Pass, true))
{
while (fread(account, pass, 256))
{
passres = GetFileString(pass);
if (strfind(passres, "AdminLevel") != -1)
{
value = GetFileValue(pass);
AccInfo[playerid][AdminLevel] = strval(value);
}
if (strfind(passres, "Cash") != -1)
{
value = GetFileValue(pass);
AccInfo[playerid][Cash] = strval(value);
}
fclose(account);
AccInfo[playerid][Logged] = 1;
}
else
{
SendClientMessage(playerid, RED, "Incorrect Password.");
fclose(account);
return 1;
}
GivePlayerMoney(playerid, AccInfo[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 (AccInfo[playerid][AdminLevel] > 0)
{
format(str, sizeof str, "You are now logged in as a admin level [%d]", AccInfo[playerid][AdminLevel]);
SendClientMessage(playerid, WHITE, str);
}
}
}
return 1;
}
And i get 1 erroe and i warning

Код:
C:\Documents and Settings\Administrator\Desktop\Servers & Scripts\CroRoleplay\gamemodes\CroRoleplay.pwn(215) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\Servers & Scripts\CroRoleplay\gamemodes\CroRoleplay.pwn(221) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Please help
Reply
#2

and where is the 221 and the 215
Reply
#3

Код:
public OnPlayerLogin(playerid, Pass[])
{
new Name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, Name, sizeof Name);
format(str, sizeof str,"/Accounts/%s.txt", Name);
new File:account = fopen(str, io_write);
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(AccInfo[playerid][password], value, 0, strlen(value)-1, 128);
}
if (!strcmp(AccInfo[playerid][password], Pass, true))
{
while (fread(account, pass, 256))
{
passres = GetFileString(pass);
if (strfind(passres, "AdminLevel") != -1)
{
value = GetFileValue(pass);
AccInfo[playerid][AdminLevel] = strval(value);
}
if (strfind(passres, "Cash") != -1)
{
value = GetFileValue(pass);
AccInfo[playerid][Cash] = strval(value);
}
fclose(account);
AccInfo[playerid][Logged] = 1;
}
else <== 215
{
SendClientMessage(playerid, RED, "Incorrect Password.");
fclose(account);
return 1;
}
GivePlayerMoney(playerid, AccInfo[playerid][Cash]); <== 221
format(str, sizeof str, "You have successfully logged in as %s", Name);
SendClientMessage(playerid, GREEN, str);
printf("%s has logged in", Name);
if (AccInfo[playerid][AdminLevel] > 0)
{
format(str, sizeof str, "You are now logged in as a admin level [%d]", AccInfo[playerid][AdminLevel]);
SendClientMessage(playerid, WHITE, str);
}
}
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)