SA-MP Forums Archive
OnPlayerConnect Error/Warning? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: OnPlayerConnect Error/Warning? (/showthread.php?tid=340872)



OnPlayerConnect Error/Warning? - kamzaf - 08.05.2012

Hi, for some reason I am having a problem with this script, can anyone help:

Код:
public OnPlayerConnect(playerid)
{
        new name[MAX_PLAYER_NAME], string[44];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[SERVER]: %s has joined the server.",name);
        SendClientMessageToAll(0xFFFFFFFF, string);
	SendClientMessage(playerid, 0xFFFF00AA, "Welcome to ~~~~~~~~~~~~~~~~~~~~~~~~~.");
	SendClientMessage(playerid, 0xAA3333AA, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
	SendClientMessage(playerid, 0xAA3333AA, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...");
	SendClientMessage(playerid, 0xAFAFAFAA, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
	GameTextForPlayer(playerid,"Welcome to ~~~~, By ~~~~",5000,1);
	return 1;
}
    SetPlayerTeamColor(playerid)
    {
        if (gTeam[playerid] == TEAM_ArmyRUS)
        {
        SetPlayerTeam(playerid,1);
        SetPlayerColor(playerid, TEAM_ArmyRUS_COLOR);
        }
        else if (gTeam[playerid] == TEAM_ArmyUSA)
        {
        SetPlayerTeam(playerid,2);
        SetPlayerColor(playerid, TEAM_ArmyUSA_COLOR);
        }
}
And this is the message I get:
Код:
~~~~~~~~~~~~~~~~~~~~~~~ : warning 209: function "SetPlayerTeamFromClass" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Help would be appreciated!


Re: OnPlayerConnect Error/Warning? - TheDominator - 08.05.2012

pawn Код:
public OnPlayerConnect(playerid)
{
        new name[MAX_PLAYER_NAME], string[44];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[SERVER]: %s has joined the server.",name);
        SendClientMessageToAll(0xFFFFFFFF, string);
    SendClientMessage(playerid, 0xFFFF00AA, "Welcome to ~~~~~~~~~~~~~~~~~~~~~~~~~.");
    SendClientMessage(playerid, 0xAA3333AA, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
    SendClientMessage(playerid, 0xAA3333AA, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...");
    SendClientMessage(playerid, 0xAFAFAFAA, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
    GameTextForPlayer(playerid,"Welcome to ~~~~, By ~~~~",5000,1);
    return 1;
}
    SetPlayerTeamColor(playerid)
    {
        if (gTeam[playerid] == TEAM_ArmyRUS)
        {
        SetPlayerTeam(playerid,1);
        SetPlayerColor(playerid, TEAM_ArmyRUS_COLOR);
        }
        else if (gTeam[playerid] == TEAM_ArmyUSA)
        {
        SetPlayerTeam(playerid,2);
        SetPlayerColor(playerid, TEAM_ArmyUSA_COLOR);
        }
}
From the looks of this you've forgotten to add:

pawn Код:
return 1;
At the end of SetPlayerTeamColor.


Re: OnPlayerConnect Error/Warning? - kamzaf - 08.05.2012

True, but i dont understand where to add it. I've tried different things and it will either 1: give me more errors or 2: the message will still be there.


Re: OnPlayerConnect Error/Warning? - TheDominator - 08.05.2012

Have you tried using:

pawn Код:
return 0;



Re: OnPlayerConnect Error/Warning? - kamzaf - 08.05.2012

but where should i use it? i'm just confused with that part.


Re: OnPlayerConnect Error/Warning? - TheDominator - 08.05.2012

pawn Код:
public OnPlayerConnect(playerid)
{
        new name[MAX_PLAYER_NAME], string[44];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "[SERVER]: %s has joined the server.",name);
        SendClientMessageToAll(0xFFFFFFFF, string);
    SendClientMessage(playerid, 0xFFFF00AA, "Welcome to ~~~~~~~~~~~~~~~~~~~~~~~~~.");
    SendClientMessage(playerid, 0xAA3333AA, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
    SendClientMessage(playerid, 0xAA3333AA, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...");
    SendClientMessage(playerid, 0xAFAFAFAA, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
    GameTextForPlayer(playerid,"Welcome to ~~~~, By ~~~~",5000,1);
    return 1;
}
    SetPlayerTeamColor(playerid)
    {
        if (gTeam[playerid] == TEAM_ArmyRUS)
        {
        SetPlayerTeam(playerid,1);
        SetPlayerColor(playerid, TEAM_ArmyRUS_COLOR);
        }
        else if (gTeam[playerid] == TEAM_ArmyUSA)
        {
        SetPlayerTeam(playerid,2);
        SetPlayerColor(playerid, TEAM_ArmyUSA_COLOR);
        }
        return 0;
}



Re: OnPlayerConnect Error/Warning? - paulor - 09.05.2012

put return 1; to SetPlayerTeamFromClass.

pawn Код:
public SetPlayerTeamFromClass(playerid, classid)
{
     return 1;
}