SA-MP Forums Archive
Not defined? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Not defined? (/showthread.php?tid=383699)



Not defined? - davve95 - 08.10.2012

Hi!


It says TEAM_CLOWNS are not defined but it is.. :S


Code:

pawn Код:
public OnPlayerSpawn(playerid)
{
    if (gTeam[playerid] == TEAM_CLOWNS 0);
    {
        SetPlayerColor(playerid, TEAM_CLOWNS 0);
    }
    else if (gTeam[playerid] == TEAM_HOBOS 1) ;
    {
        SetPlayerColor(playerid, TEAM_HOBOS) 1);
    }
    else if(gTeam[playerid] == TEAM_COPS) 2);
    {
        SetPlayerColor(playerid, TEAM_COPS)2);
    }
    else if (gTeam[playerid] == TEAM_ARMY)3);
    {
        SetPlayerColor(playerid, TEAM_ARMY)3);
    }
     return 1;
}

Part of OnPlayerRequestClass:

pawn Код:
public OnPlayerRequestClass( playerid, classid )
{
    switch ( classid )
    {
        case 0: //
        { // Then
            GameTextForPlayer( playerid, "~r~TEAM Clowns", 300, 3 );
            // Sends a gametext for player
            // ~r~ is a red color in gametext.
            // Arguments : Player ID, const string[ ], time ( milliseconds ), style
            // Wiki for more info
            SetPlayerTeam( playerid, TEAM_ClOWNS);
            gTeam[playerid] = TEAM_ClOWNS;
        }
And the define:

pawn Код:
#define TEAM_ClOWNS 0
Error message:

Код:
C:\Users\Davve\Desktop\Scripting\Server Las Venturas TDM\LV.pwn(329) : error 017: undefined symbol "TEAM_CLOWNS"
C:\Users\Davve\Desktop\Scripting\Server Las Venturas TDM\LV.pwn(329) : warning 215: expression has no effect
C:\Users\Davve\Desktop\Scripting\Server Las Venturas TDM\LV.pwn(329) : error 001: expected token: ";", but found ")"
C:\Users\Davve\Desktop\Scripting\Server Las Venturas TDM\LV.pwn(329) : error 029: invalid expression, assumed zero
C:\Users\Davve\Desktop\Scripting\Server Las Venturas TDM\LV.pwn(329) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Not defined? - Skillet` - 08.10.2012

You're using a number after definition ?
Код:
public OnPlayerSpawn(playerid)
{
	switch(gTeam[playerid])
	{
		case TEAM_CLOWNS: SetPlayerColor(playerid, TEAM_CLOWNS 0);
		case TEAM_HOBOS: SetPlayerColor(playerid, TEAM_HOBOS) 1);
		case TEAM_COPS: SetPlayerColor(playerid, TEAM_COPS)2);
		case TEAM_ARMY: SetPlayerColor(playerid, TEAM_ARMY)3);
	}
	return 1;
}
Also suggest you to use SetPlayerTeam instead of gTeam array.


Re: Not defined? - davve95 - 08.10.2012

I can't understeand SetPlayerTeam..

Yes I used numbers after define.. Thanks I'll try with ur code!.


Edit: Didn't work with that code u sent.. Got a similar error:


pawn Код:
C:\Users\Davve\Desktop\Scripting\Server Las Venturas TDM\LV.pwn(443) : error 017: undefined symbol "TEAM_CLOWNS"
C:\Users\Davve\Desktop\Scripting\Server Las Venturas TDM\LV.pwn(443) : error 017: undefined symbol "TEAM_CLOWNS"
C:\Users\Davve\Desktop\Scripting\Server Las Venturas TDM\LV.pwn(443) : error 029: invalid expression, assumed zero
C:\Users\Davve\Desktop\Scripting\Server Las Venturas TDM\LV.pwn(443) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.



Re: Not defined? - Skillet` - 08.10.2012

Quote:
Originally Posted by davve95
Посмотреть сообщение
I can't understeand SetPlayerTeam..

Yes I used numbers after define.. Thanks I'll try with ur code!.
You're using an array to set player team and check player team.
with SetPlayerTeam and GetPlayerTeam you can get\set player team also they have a little feature that samp added to them :
Код:
Players on the same team can not kill or damage each other unless they use a knife.
which is useful if you want to get rid of all the team-killers


Re: Not defined? - davve95 - 08.10.2012

There are no good examples on wiki that's why I don't understand it... I don't know how to put in the teams in it.. Oh wait is it like this?? :

Example:

#define TEST_TEAM 0


SetPlayerTeam ( playerid, 0 );

??
But still don't know how to add more teams if it's like that..

Do you just suggest to use that instead? Or will it fix my problem?.

Edit: Lookt at Wiki, I don't think it's like my example! xD I just gussed..


Re: Not defined? - Riddick94 - 08.10.2012

Yes it can be like you done. Or use a macro definition in your SetPlayerTeam. Just replace a number '0' with your macro, in this time its TEAM_CLOWNS.


Re: Not defined? - davve95 - 08.10.2012

Okay thanks! I never heard of macro, I will see if I can figure it it how to do and test it.