Getting stupid issues with a simple login system
#2

You are stopping each if and each else if before it could start.
Never place a semicolon after:
pawn Код:
if(code here)
else if(code here)
You didn't give sizeof a value.
It should be:
pawn Код:
format(string, sizeof(string), "blablabla", playername);
You opened the function brackets after new string[64];
Local variables don't require to open brackets.

pawn Код:
new playername[12], string[64];
    if (pInfo(playerid)[pAdmin] == 0)
    {
        format(string,sizeof(string),"Player %s has joined the server.",playername);
        SendClientMessageToAll(0xFFFFFFAA,string);
    }
I fixed the mistakes and the indentation.

pawn Код:
public OnPlayerLogin(playerid)
{
    new playername[12], string[64];
    if (pInfo(playerid)[pAdmin] == 0)
    {
        format(string,sizeof(string),"Player %s has joined the server.",playername);
        SendClientMessageToAll(0xFFFFFFAA,string);
    }
    else if(pInfo(playerid)[pAdmin] == 1)
    {
        format(string,sizeof(string),"Applicant %s has joined the server.",playername);
        SendClientMessageToAll(0xFFFFFFAA,string);
    }
    else if(IsPlayerAdmin(playerid) == 2)
    {
        format(string,sizeof(string),"Cadet %s has joined the server.",playername);
        SendClientMessageToAll(0xFFFFFFAA,string);
    }
    else if(IsPlayerAdmin(playerid) == 3)
    {
        format(string,sizeof(string),"Admin %s has joined the server.",playername);
        SendClientMessageToAll(0xFFFFFFAA,string);
    }
    else if(IsPlayerAdmin(playerid) == 4)
    {
        format(string,sizeof(string),"Server Tech %s has joined the server.",playername);
        SendClientMessageToAll(0xFFFFFFAA,string);
    }
    else if(IsPlayerAdmin(playerid) == 5)
    {
        format(string,sizeof(string),"Owner %s has joined the server.",playername);
        SendClientMessageToAll(0xFFFFFFAA,string);
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)