SA-MP Forums Archive
[SOLVED] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] (/showthread.php?tid=119469)



[SOLVED] - waza75 - 08.01.2010

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.




Re: [HELP] - Doppeyy - 08.01.2010

Wich one is line 21 exactly then ?

[Doppeyy


Re: [HELP] - Correlli - 08.01.2010

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.


Re: [HELP] - SiJ - 08.01.2010

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);
}
}




Re: [HELP] - Correlli - 08.01.2010

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


Re: [HELP] - waza75 - 08.01.2010

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


Re: [HELP] - waza75 - 08.01.2010

-.- just read the message. Thanks



Re: [HELP] - SiJ - 08.01.2010

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


Re: [HELP] - waza75 - 08.01.2010

no need to right because there are only 2 teams?


Re: [HELP] - SiJ - 08.01.2010

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);
    }