[HELP] Team problem
#1

Aigh't I was making teams by help from my dear friend Klutty and we've both compared our codes, and seriously, there's nothing we can find that's the problem with it.


Here's the code. I get errors of undefined symbols when there's nothing wrong with it as we can see.

I'd be thankful if somone could solve it..

http://pastebin.com/q5cmzDvT

Errors:

Код:
C:\Documents and Settings\Adam(1337)\Skrivbord\SAMP SCRIPT\gamemodes\HTDM.pwn(94) : error 017: undefined symbol "SetPlayerFromTeamToClass"
C:\Documents and Settings\Adam(1337)\Skrivbord\SAMP SCRIPT\gamemodes\HTDM.pwn(116) : error 017: undefined symbol "SetPlayerToTeamColor"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

http://pastebin.com/9XBE3tqG
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

new team[MAX_PLAYERS];
#define BALLAS 0xFF00FFAA
#define GROVE 0x00FF00AA
#define team1 1
#define team2 2
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x3A47DEFF
#define COLOR_TAN 0xBDB76BAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_BLACK 0x00000000
#define COLOR_DARKGREY 0x696969FF


#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Hudgens Team Deathmatch!");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("HTDM");
    AddPlayerClass(105,2311.3455,-1658.9199,14.2456,270.2288,24,100,29,300,0,0); // Grove
    AddPlayerClass(106,2311.3455,-1658.9199,14.2456,270.2288,32,300,22,150,0,0); // Grove
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
    team[playerid] = team1;
    }
    if(classid == 1)
    {
    team[playerid] = team2;
    }
    SetPlayerPos(playerid, 11449.5397,-807.4916,84.2771);
    SetPlayerCameraPos(playerid, 1455.1418,-825.0184,83.1046);
    SetPlayerCameraLookAt(playerid, 1449.5397,-807.4916,84.2771);
    return 1;
}

public OnPlayerConnect(playerid)
{

    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{

    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(team[playerid] == team1)
    {
        SetPlayerColor(playerid, GROVE);
        SetPlayerTeam(playerid, 1);
    }
    if(team[playerid] == team2)
    {
        SetPlayerColor(playerid, BALLAS);
        SetPlayerTeam(playerid, 2);
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{

    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
explaination: for SetPlayerTeamFromClass, just not make that and go to onplayerrequestclass and put
pawn Код:
if(classid == 0) // first skin
{
     team[playerid] = team1; // first team
}
if(classid == 1) // second skin
{
      team[playerid] = team2; // second team
}
then for SetPlayerToTeamColor just put onplayerspawn
pawn Код:
if(team[playerid] == team1)
    {
        SetPlayerColor(playerid, GROVE);//color
        SetPlayerTeam(playerid, 1);// you need team so if someone shoots another person in team, they wont lose health
    }
    if(team[playerid] == team2)
    {
        SetPlayerColor(playerid, BALLAS); // color
        SetPlayerTeam(playerid, 2);
    }
i think they removed SetPlayerToTeamColor andSetplayerTeamfromclass in 0.3b
Reply
#3

Thanks mate.
Reply
#4

np
Reply
#5

Infact I got some other shit with it lol.

I'm trying to make more than just 2 screens and I get multiple problems.

Here's the deal, I made a cop team and a SendClientMessage function when you spawn you will get *You have joined team *name* But it doesn't work, the first time I spawn with a skin nothing shows up.

When I get in and change skin to ballas, which I added the correct skin for it says "You have joined team grove" but then after I kill myself a couple of times it sorts out with grove/ballas team (You have joined team Grove) etc.
The problem is, when I join the team COPS , it shows *You have joined team BALLAS* when I clearly added another team in the code.

Look:

Here's my defintion for teams.
Код:
new team[MAX_PLAYERS];
#define GROVE 0x00FF00AA
#define BALLAS 0xFF00FFAA
#define COPS 0x3A47DEFF
#define team1 1
#define team2 2
#define team3 3
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x3A47DEFF
#define COLOR_TAN 0xBDB76BAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_BLACK 0x00000000
#define COLOR_DARKGREY 0x696969FF
OnPlayerSpawn
Код:
public OnPlayerSpawn(playerid)
{
		if(team[playerid] == team1)
    {
        SetPlayerColor(playerid, GROVE);//color
        SetPlayerTeam(playerid, 1);// you need team so if someone shoots another person in team, they wont lose health
		SendClientMessage(playerid, GROVE, "You have joined team GROVE");
    }
	 	if(team[playerid] == team2)
    {
        SetPlayerColor(playerid, BALLAS); // color
        SetPlayerTeam(playerid, 2);
		SendClientMessage(playerid, BALLAS, "You have joined team BALLAS");
    }
        if(team[playerid] == team3)
	{
	    SetPlayerColor(playerid, COPS); //color
	    SetPlayerTeam(playerid, 3);
		SendClientMessage(playerid, COPS, "You have joined team COPS");
		}
   		return 1;
}
OnPlayerRequestClass
Код:
public OnPlayerRequestClass(playerid, classid)
{
	if(classid == 0|1|2) // first skin
{
	 team[playerid] = team1; // first team
}
	if(classid == 3|4|5) // second skin
{
	team[playerid] = team2; // second team
}
	if(classid == 6|7|8) //third skins
{
	team[playerid] = team3; //third team
}
  	SetPlayerPos(playerid,2311.3455,-1658.9199,14.2456);
	SetPlayerCameraPos(playerid, 2319.4363,-1658.9548,13.9579);
	SetPlayerCameraLookAt(playerid, 2311.3455,-1658.9199,14.2456);
    return 1;
}
Код:
public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("HTDM");
    AddPlayerClass(105,2311.3455,-1658.9199,14.2456,270.2288,24,100,29,300,0,0); // Grove
    AddPlayerClass(106,2311.3455,-1658.9199,14.2456,270.2288,32,300,22,150,0,0); // Grove
    AddPlayerClass(107,2311.3455,-1658.9199,14.2456,270.2288,32,300,22,150,0,0); // Grove
   	AddPlayerClass(102,2164.6941,-1685.5839,15.0859,302.4727,24,100,29,300,0,0); // Ballas
	AddPlayerClass(103,2164.6941,-1685.5839,15.0859,302.4727,32,300,22,150,0,0); // Ballas
	AddPlayerClass(104,2164.6941,-1685.5839,15.0859,302.4727,22,150,25,100,0,0); // Ballas
	AddPlayerClass(280,1540.2865,-1674.9822,13.5503,88.6450,24,100,29,300,0,0); // Snutspawn
	AddPlayerClass(281,1540.2865,-1674.9822,13.5503,88.6450,32,300,22,150,0,0); // Snutspawn
	AddPlayerClass(282,1540.2865,-1674.9822,13.5503,88.6450,25,300,22,150,0,0); // Snutspawn
Ignore the indentation it's fine in my code.

Any solution? Thanks in advance.
Reply
#6

pawn Код:
public OnPlayerSpawn(playerid)
{
        if(GetPlayerSkin(playerid) == 105)//grove
        {
        SetPlayerColor(playerid, GROVE);//color
        SetPlayerTeam(playerid, 1);// you need team so if someone shoots another person in team, they wont lose health
        SendClientMessage(playerid, GROVE, "You have joined team GROVE");
        }
        if(GetPlayerSkin(playerid) == 106)//grove
        {
        SetPlayerColor(playerid, GROVE);//color
        SetPlayerTeam(playerid, 1);// you need team so if someone shoots another person in team, they wont lose health
        SendClientMessage(playerid, GROVE, "You have joined team GROVE");
        }
        if(GetPlayerSkin(playerid) == 107)//grove
        {
        SetPlayerColor(playerid, GROVE);//color
        SetPlayerTeam(playerid, 1);// you need team so if someone shoots another person in team, they wont lose health
        SendClientMessage(playerid, GROVE, "You have joined team GROVE");
        }
        if(GetPlayerSkin(playerid) == 102)//ballas
        {
        SetPlayerColor(playerid, BALLAS); // color
        SetPlayerTeam(playerid, 2);
        SendClientMessage(playerid, BALLAS, "You have joined team BALLAS");
        }
        if(GetPlayerSkin(playerid) == 103)//ballas
        {
        SetPlayerColor(playerid, BALLAS); // color
        SetPlayerTeam(playerid, 2);
        SendClientMessage(playerid, BALLAS, "You have joined team BALLAS");
        }
        if(GetPlayerSkin(playerid) == 104)//ballas
        {
        SetPlayerColor(playerid, BALLAS); // color
        SetPlayerTeam(playerid, 2);
        SendClientMessage(playerid, BALLAS, "You have joined team BALLAS");
        }
        if(GetPlayerSkin(playerid) == 280)//cop
        {
        SetPlayerColor(playerid, COPS); //color
        SetPlayerTeam(playerid, 3);
        SendClientMessage(playerid, COPS, "You have joined team COPS");
        }
        if(GetPlayerSkin(playerid) == 281)//cop
        {
        SetPlayerColor(playerid, COPS); //color
        SetPlayerTeam(playerid, 3);
        SendClientMessage(playerid, COPS, "You have joined team COPS");
        }
        if(GetPlayerSkin(playerid) == 282)//cop
        {
        SetPlayerColor(playerid, COPS); //color
        SetPlayerTeam(playerid, 3);
        SendClientMessage(playerid, COPS, "You have joined team COPS");
        }
        return 1;
}
problem with onplayerskin so i change if player spawn with that skin id
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)