Team Errors. Please help!
#1

Код:
C:\Users\Mace\Desktop\LS Gang Wars\gamemodes\Gang_Wars_LS.pwn(58) : error 017: undefined symbol "SetPlayerTeamFromClass"
C:\Users\Mace\Desktop\LS Gang Wars\gamemodes\Gang_Wars_LS.pwn(181) : error 017: undefined symbol "SetPlayerToTeamColour"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid, classid) // Line 58
   {
    	if(classid == 0)
    	{
        	gTeam[playerid] = GROVE;
        	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
		SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
		SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    	}
Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerToTeamColour(playerid) // Line 181
    {
    	if(gTeam[playerid] == GROVE)
    	{
                 SetPlayerColor(playerid, GROVE_COLOUR);
    	}
I was following a tutorial and these are the errors I got.
Reply
#2

Hello, Mc.Pepe.

You're missing the functions, here's an example:
pawn Код:
stock SetPlayerTeamFromClass(playerid, classid)
{
    switch(classid)
    {
        case 0: gTeam[playerid] = TEAM_BALLAS;
        case 1: gTeam[playerid] = TEAM_AZTECA;
    }
}

stock SetPlayerToTeamColour(playerid)
{
    switch(gTeam[playerid])
    {
        case TEAM_BALLAS: SetPlayerColor(playerid, 0x8080C0FF);
        case TEAM_AZTECA: SetPlayerColor(playerid, 0x00FFFFFF);
    }
}
Reply
#3

Код:
C:\Users\Mace\Desktop\LS Gang Wars\gamemodes\Gang_Wars_LS.pwn(59) : error 001: expected token: ";", but found "{"
C:\Users\Mace\Desktop\LS Gang Wars\gamemodes\Gang_Wars_LS.pwn(182) : error 001: expected token: ";", but found "{"
More errors after I added the functions.
Reply
#4

Add ";" after the functions in use.

pawn Код:
SetPlayerTeamFromClass(playerid, classid)
pawn Код:
SetPlayerTeamFromClass(playerid, classid);
Reply
#5

You're not showing much of your code here.

But from what I can see, I think you are trying to define a function in a function, you can't do this in pawn (afaik)
Reply
#6

New issue while working a different script...

Here's the errors I'm getting...
Код:
C:\Users\Mace\Desktop\LS Cops and Robbers\gamemodes\LS_CnR.pwn(224) : error 004: function "SetPlayerTeamFromClass" is not implemented
C:\Users\Mace\Desktop\LS Cops and Robbers\gamemodes\LS_CnR.pwn(488) : error 004: function "SetPlayerToTeamColour" is not implemented
C:\Users\Mace\Desktop\LS Cops and Robbers\gamemodes\LS_CnR.pwn(701) : error 055: start of function body without function header
C:\Users\Mace\Desktop\LS Cops and Robbers\gamemodes\LS_CnR.pwn(702) : error 010: invalid function or declaration
C:\Users\Mace\Desktop\LS Cops and Robbers\gamemodes\LS_CnR.pwn(704) : error 010: invalid function or declaration
C:\Users\Mace\Desktop\LS Cops and Robbers\gamemodes\LS_CnR.pwn(705) : error 010: invalid function or declaration
C:\Users\Mace\Desktop\LS Cops and Robbers\gamemodes\LS_CnR.pwn(710) : error 055: start of function body without function header
C:\Users\Mace\Desktop\LS Cops and Robbers\gamemodes\LS_CnR.pwn(711) : error 010: invalid function or declaration
C:\Users\Mace\Desktop\LS Cops and Robbers\gamemodes\LS_CnR.pwn(713) : error 010: invalid function or declaration
C:\Users\Mace\Desktop\LS Cops and Robbers\gamemodes\LS_CnR.pwn(714) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


10 Errors.
[Finished in 0.5s]
The codes that are having the issues...
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1553.0560,-1360.1155,329.4693);
    SetPlayerCameraPos(playerid, 1546.7925,-1360.0486,329.4628);
    SetPlayerCameraLookAt(playerid, 1546.7925,-1360.0486,329.4628);
    SetPlayerFacingAngle(playerid, 90);
    SetPlayerTeamFromClass(playerid, classid); // Line 224
    {
        if(classid == 0)
        {
            gTeam[playerid] = TEAM_COPS;
        }
    }
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    TextDrawShowForPlayer(playerid, randommsg);
    SetPlayerToTeamColour(playerid, classid); // Line 488
    {
        if(gTeam[playerid] == TEAM_COPS)
        {
            SetPlayerColor(playerid, COPS_COLOR);
        }
        if(gTeam[playerid] == TEAM_CIVILIAN)
        {
            SetPlayerColor(playerid, CIVIL_COLOR);
        }
    }
    return 1;
}
pawn Код:
stock SetPlayerTeamFromClass(playerid, classid); // line 700
{
    switch(classid)
    {
        case 0..7: gTeam[playerid] = TEAM_COPS;
        case 8..57: gTeam[playerid] = TEAM_CIVILIAN;
    }
}

stock SetPlayerToTeamColour(playerid);
{
    switch(gTeam[playerid])
    {
        case TEAM_COPS: SetPlayerColor(playerid, COPS_COLOR);
        case TEAM_CIVILIAN: SetPlayerColor(playerid, CIVIL_COLOR);
    }
}
Reply
#7

You're doing bad in your code.
Remove ; from those stocks


pawn Код:
stock SetPlayerTeamFromClass(playerid, classid) // line 700
{
    switch(classid)
    {
        case 0..7: gTeam[playerid] = TEAM_COPS;
        case 8..57: gTeam[playerid] = TEAM_CIVILIAN;
    }
}

stock SetPlayerToTeamColour(playerid)
{
    switch(gTeam[playerid])
    {
        case TEAM_COPS: SetPlayerColor(playerid, COPS_COLOR);
        case TEAM_CIVILIAN: SetPlayerColor(playerid, CIVIL_COLOR);
    }
}
Remove the parameter classid from the function SetPlayerTeamToColour and this must be just like this since you're defining all in the stocks

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1553.0560,-1360.1155,329.4693);
    SetPlayerCameraPos(playerid, 1546.7925,-1360.0486,329.4628);
    SetPlayerCameraLookAt(playerid, 1546.7925,-1360.0486,329.4628);
    SetPlayerFacingAngle(playerid, 90);
    SetPlayerTeamFromClass(playerid, classid); // Line 224
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerToTeamColour(playerid); // Line 488
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)