[SOLVED]
#1

I looked for teamdeathmatch and this was included in the tut.
Код:
// Los Santos TDM made by Waza75 version 1.0 Enjoy :)

#include <a_samp>

#define TEAM_HOOKER 
#define TEAM_BUM 
#define TEAM_HOOKER_COLOR 0xAABB0099
#define TEAM_BUM_COLOR 0x9900BBAA

new gTeam[MAX_PLAYERS];

main ()
{
	print("Los Santos TDM Made by Waza75 owner: YOURNAMEHERE");
}

SetPlayerTeamFromClass(playerid, classid)
{
	if (classid == 0)
	{
		gTeam(playerid) = TEAM_HOOKER;
	}
	else
	{
		gTeam(playerid) = TEAM_BUM;
	}
}

SetPlayerToTeamColor(playerid)
{
	if(gTeam(playerid) == TEAM_HOOKER)
	{
		SetPlayerColor(playerid, TEAM_HOOKER_COLOR);
	}
	else(gTeam(playerid) == TEAM_BUM)
	{
		SetPlayerColor(playerid, TEAM_BUM_COLOR);
	}
}


public OnFilterScriptInit()
{
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerTeamFromClass(playerid, classid);
}
A piece from the code. It gives me errors could you hepl me out fixing them?

Код:
C:\Users\kids\Desktop\SA-MP Scripter\LSTDM.pwn(21) : error 012: invalid function call, not a valid address
C:\Users\kids\Desktop\SA-MP Scripter\LSTDM.pwn(21) : warning 215: expression has no effect
C:\Users\kids\Desktop\SA-MP Scripter\LSTDM.pwn(21) : error 001: expected token: ";", but found ")"
C:\Users\kids\Desktop\SA-MP Scripter\LSTDM.pwn(21) : error 029: invalid expression, assumed zero
C:\Users\kids\Desktop\SA-MP Scripter\LSTDM.pwn(21) : fatal error 107: too many error messages on one line

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


4 Errors.
The errors.

Please help me out. Thanks.

Reply
#2

Wich one is line 21 exactly then ?

[Doppeyy
Reply
#3

pawn Код:
gTeam(playerid) = TEAM_HOOKER;
pawn Код:
if(gTeam(playerid) == TEAM_HOOKER)
This is wrong.

You need to use it like this:
pawn Код:
gTeam[playerid] = TEAM_HOOKER;
pawn Код:
if(gTeam[playerid] == TEAM_HOOKER)
as gTeam is not a function, it's an array.
Reply
#4

Also:
Quote:

SetPlayerToTeamColor(playerid)
{
if(gTeam(playerid) == TEAM_HOOKER)
{
SetPlayerColor(playerid, TEAM_HOOKER_COLOR);
}
else if(gTeam(playerid) == TEAM_BUM)
{
SetPlayerColor(playerid, TEAM_BUM_COLOR);
}
}

Reply
#5

Quote:
Originally Posted by SiJ
/* code */
You're also doing it a bit wrong, check my post above.
Reply
#6

don't fully understand your code.
Could you ad some more to explain?
Reply
#7

-.- just read the message. Thanks
Reply
#8

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by SiJ
/* code */
You're also doing it a bit wrong, check my post above.
I know.. I only wanted to show that he needs to put if after else
Reply
#9

no need to right because there are only 2 teams?
Reply
#10

Quote:
Originally Posted by waza75
no need to right because there are only 2 teams?
if there are only two teams and you're not planning to do more, so you can just leave else.. Like this:
pawn Код:
if(gTeam[playerid] == TEAM_HOOKER)
    {
        SetPlayerColor(playerid, TEAM_HOOKER_COLOR);
    }
    else
    {
        SetPlayerColor(playerid, TEAM_BUM_COLOR);
    }
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)