SA-MP Forums Archive
[HELP] Warnings in my script. - 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: [HELP] Warnings in my script. (/showthread.php?tid=119564)



[HELP] Warnings in my script. - waza75 - 08.01.2010

I want to make it that if you are in team "Hooker" You can choose skin id 63, 64, 75, 78

I tried it like:

Code:
SetPlayerTeamFromClass(playerid, classid)
{
	if (classid == 63, 64, 75, 78)
	{
		gTeam[playerid] = TEAM_HOOKER;
	}
	else
	{
		gTeam[playerid] = TEAM_BUM;
	}
}
Thanks



Re: Skins for teams [HELP] - Lajko1 - 08.01.2010

actualy u made if u chose those skins u ARE IN TEAM Hookers,if u chose another skins that u add u will be in another team


Re: Skins for teams [HELP] - lameguy - 08.01.2010

So you want to show only skins 63, 64, 75, 78 for TEAM_HOOKER?

If so, then you should set players team before class selection.

But, you could show every skins on your server to player, not only those 4, but if he selects class 63, 64, 75 or 78, he would become TEAM_HOOKER member.


Re: Skins for teams [HELP] - Lajko1 - 08.01.2010

sorry for duble post but u made a mistake 1 skin in your gamemode = 1 class id so u cant give class id 64 or waht ever if u have ther 5 skins ...


so in ur code is ''classid'' first put under OnGameModeInit ... AddPlayerClass(................................... ); ....

let me explain

if u have like this

Code:
public OnGameModeInit()
{
   AddPlayerClass(SKINID,FLOAT X,FLOAT Y,FLOAT Z,FACING ANGLE,weapon 1,ammo for weapon 1,weapon 2,ammo for weapon 2,weapon 3,ammo for weapon 3); // CLASSID 0

  
   return 1;
}
so in your example should look like this,FOR EXAMPLE I GIVE U THIS CODE...

Code:
public OnGameModeInit()
{
   //HOOKERS CLASSES
   AddPlayerClass(64,1494.6130,-878.9011,59.7693,23.5744,0,0,0,0,0,0);// SO THIS IS CLASS ID 0
   AddPlayerClass(63,1494.6130,-878.9011,59.7693,23.5744,0,0,0,0,0,0);// SO THIS IS CLASS ID 1
   AddPlayerClass(75,1494.6130,-878.9011,59.7693,23.5744,0,0,0,0,0,0);// SO THIS IS CLASS ID 2
   AddPlayerClass(78,1494.6130,-878.9011,59.7693,23.5744,0,0,0,0,0,0);// SO THIS IS CLASS ID 3

  //than make some classes for team BUM ... like this

  //BUM CLASSES
  AddPlayerClass(105,1494.6130,-878.9011,59.7693,23.5744,0,0,0,0,0,0);// SO THIS IS CLASS ID 4
  AddPlayerClass(106,1494.6130,-878.9011,59.7693,23.5744,0,0,0,0,0,0);// SO THIS IS CLASS ID 5
  AddPlayerClass(107,1494.6130,-878.9011,59.7693,23.5744,0,0,0,0,0,0);// SO THIS IS CLASS ID 6
   return 1;
}
so than u make

Code:
SetPlayerTeamFromClass(playerid, classid)
{
	if (classid == 0, 1, 2, 3)
	{
		gTeam[playerid] = TEAM_HOOKER;
	}
	if (classid == 4,5,6)
	{
		gTeam[playerid] = TEAM_BUM;
	}
}
i explain u all what u need to know for more info look at wiki-samp and u will learn much much and much


Re: Skins for teams [HELP] - waza75 - 08.01.2010

I have done all that thanks anyway. Will look at it now ^^



Re: Skins for teams [HELP] - waza75 - 08.01.2010

It worked but Now I have 3 warnings.
Code:
C:\Users\kids\Desktop\SA-MP Scripter\LSTDM.pwn(19) : warning 206: redundant test: constant expression is non-zero
C:\Users\kids\Desktop\SA-MP Scripter\LSTDM.pwn(23) : warning 206: redundant test: constant expression is non-zero
C:\Users\kids\Desktop\SA-MP Scripter\LSTDM.pwn(60) : warning 203: symbol is never used: "SetPlayerToTeamColor"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
This is the script.
Code:
// Los Santos TDM made by Waza75 version 1.0 Enjoy :)

#include <a_samp>

#define TEAM_HOOKER 1
#define TEAM_BUM 2
#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, 1, 2, 3, 4)
	{
		gTeam[playerid] = TEAM_HOOKER;
	}
	if (classid == 5, 6, 7, 8)
	{
		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 OnGameModeInit()
{
	//TEAM HOOKER
	AddPlayerClass(63, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50); //CLASSID 0
	AddPlayerClass(64, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);	//CLASSID 1
	AddPlayerClass(75, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);	// ETC
	AddPlayerClass(78, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);	
	
	//TEAM BUM
	AddPlayerClass(77, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50); //CLASSID 0
	AddPlayerClass(78, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);	//CLASSID 1
	AddPlayerClass(79, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);	// ETC
	AddPlayerClass(135, 1958.3783, 1343.1572, 15.3746, 269.1425, 5, 0, 22, 100, 32, 50);	
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerTeamFromClass(playerid, classid);
}



Re: [HELP] Warnings in my script. - waza75 - 08.01.2010

Anyone?



Re: [HELP] Warnings in my script. - Joe Staff - 08.01.2010

Your SetPlayerTeamFromClass conditional is messed up, it is probably better to use a switch for this

pawn Code:
SetPlayerTeamFromClass(playerid, classid)
{
  switch(classid)
  {
    case 0..4:gTeam[playerid] = TEAM_HOOKER;
    case 5..8:gTeam[playerid] = TEAM_BUM;
  }
}



Re: [HELP] Warnings in my script. - waza75 - 08.01.2010

Good idea. Thanks.



Re: [HELP] Warnings in my script. - waza75 - 08.01.2010

Great it worked.
Learnng every day.