SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/05/2012, 05:20 PM   #1
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Teams not working

Hello, this script compiles without errors, but doesnt work ingame?:
pawn Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#include <SAMSite>

#define COLOR_AQUA 0x00FFFFFF

//The Teams
#define TEAM_USA 0
#define TEAM_RUSSIA 1
#define TEAM_GERMANY 2
#define TEAM_BANGLADESH 3
#define TEAM_ITALY 4
#define TEAM_BRAZIL 5
#define TEAM_SERBIA 6
#define TEAM_FRANCE 7

//SAM Sites
#define US_SAM_1 0
#define US_SAM_2 1
#define US_SAM_3 2
#define US_SAM_4 3


#if defined FILTERSCRIPT

public OnFilterScriptInit()
{

    AddPlayerClassEx(0, 287, 89.5718, 1921.1682, 17.9202, 102.1499, 25, 50, 31, 400, 39, 20);
    AddPlayerClassEx(1, 166, 771.0197, 1873.7013, 8.0957, 266.5783, 18, 10, 30, 300, 34, 46);
    AddPlayerClassEx(2, 254, -642.4337, 2715.4758, 72.3750, 133.9510, 22, 85, 32, 200, 31, 700);
    AddPlayerClassEx(3, 120, -218.3907, 2645.5232, 63.1823, 178.6604, 24, 30, 30, 672, 33, 50);
    AddPlayerClassEx(4, 217, 1343.8055, -895.4852, 36.4187, 263.2225, 27, 20, 31, 965, 38, 200);
    AddPlayerClassEx(5, 239, 1421.5905, 2741.6765, 10.8203, 84.5192, 28, 40, 34, 90, 37, 120);
    AddPlayerClassEx(6, 220, -2350.1025, -1610.2853, 483.6269, 249.1130, 28, 200, 34, 40, 39, 25);
    AddPlayerClassEx(7, 123, -1505.2146, 2519.2820, 55.9182, 348.7282, 25, 50, 29, 400, 31, 300);
   
    //SAM Sites
    AddStaticSAM(237.5797,1698.6908,23.8673);
    AddStaticSAM(15.3281,1720.9646,23.8673);
    AddStaticSAM(188.2694,2083.4644,23.9063);
    AddStaticSAM(354.5453,2030.3062,23.8750);
   
    //print
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
   
    if(classid == 0)
    {
        GameTextForPlayer(playerid, "Team: ~b~USA", 6000, 6);
        SetPlayerColor(playerid, 0x0000FFFF);
    }
   
    if(classid == 1)
    {
        GameTextForPlayer(playerid, "Team: ~r~Russia", 6000, 6);
        SetPlayerColor(playerid, 0xFF0000FF);
    }
   
    if(classid == 2)
    {
        GameTextForPlayer(playerid, "Team: ~g~Germany", 6000, 6);
        SetPlayerColor(playerid, 0x00FF00FF);
    }
   
    if(classid == 3)
    {
        GameTextForPlayer(playerid, "Team: Bangladesh", 6000, 6);
        SetPlayerColor(playerid, 0xC0C0C0FF);
    }

    if(classid == 4)
    {
        GameTextForPlayer(playerid, "Team: Italy", 6000, 6);
        SetPlayerColor(playerid, 0x408080FF);
    }
   
    if(classid == 5)
    {
        GameTextForPlayer(playerid, "Team: Brazil", 6000, 6);
        SetPlayerColor(playerid, 0x808000FF);
    }
   
    if(classid == 6)
    {
        GameTextForPlayer(playerid, "Team: ~w~Serbia", 6000, 6);
        SetPlayerColor(playerid, 0xFFFFFFFF);
    }
   
    if(classid == 7)
    {
        GameTextForPlayer(playerid, "Team: France", 6000, 6);
        SetPlayerColor(playerid, 0xFF8040FF);
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(GetPlayerColor(playerid) == 0x0000FFFF) SetPlayerTeam(playerid, TEAM_USA);
    if(GetPlayerColor(playerid) == 0xFF0000FF) SetPlayerTeam(playerid, TEAM_RUSSIA);
    if(GetPlayerColor(playerid) == 0x00FF00FF) SetPlayerTeam(playerid, TEAM_GERMANY);
    if(GetPlayerColor(playerid) == 0xC0C0C0FF) SetPlayerTeam(playerid, TEAM_BANGLADESH);
    if(GetPlayerColor(playerid) == 0x408080FF) SetPlayerTeam(playerid, TEAM_ITALY);
    if(GetPlayerColor(playerid) == 0x808000FF) SetPlayerTeam(playerid, TEAM_BRAZIL);
    if(GetPlayerColor(playerid) == 0xFFFFFFFF) SetPlayerTeam(playerid, TEAM_SERBIA);
    if(GetPlayerColor(playerid) == 0xFF8040FF) SetPlayerTeam(playerid, TEAM_FRANCE);
    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("/myteam", cmdtext, true, 6) == 0)
    {
        SendClientMessage(playerid, 0xFF8040FF, "ERROR: Command is not active");
        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;
}

public OnSamSiteUpdate(samid, playerid)
{
    if(samid == US_SAM_1)
    {
        if(GetPlayerTeam(playerid, TEAM_USA))
        {
            return 0;
        }
    }
   
    if(samid == US_SAM_2)
    {
        if(GetPlayerTeam(playerid, TEAM_USA))
        {
            return 0;
        }
    }
   
    if(samid == US_SAM_3)
    {
        if(GetPlayerTeam(playerid, TEAM_USA))
        {
            return 0;
        }
    }
   
    if(samid == US_SAM_4)
    {
        if(GetPlayerTeam(playerid, TEAM_USA))
        {
            return 0;
        }
    }
   
    return 1;
}
stormchaser206 is offline   Reply With Quote
Old 19/05/2012, 05:23 PM   #2
Crazymax
Big Clucker
 
Join Date: Apr 2012
Posts: 79
Reputation: 12
Default Re: Teams not working

u added it in ur server.cfg filterscript lines?
Crazymax is offline   Reply With Quote
Old 19/05/2012, 05:24 PM   #3
iGetty
High-roller
 
iGetty's Avatar
 
Join Date: Sep 2010
Location: Falkirk, Scotland
Posts: 1,753
Reputation: 224
Default Re: Teams not working

Debug it.

USe:

pawn Code:
print("Team [TEAMNAME] works");

Also, try adding "SetPlayerTeam(playerid, TEAM);" under each of the OnPlayerRequestClass things, that might work and remove them from OnPlayerSpawn.

Edit: Max, don't post if you don't know what you're on about. This has nothing to do with his "Server.cfg" file as it's not a filterscript.
iGetty is offline   Reply With Quote
Old 19/05/2012, 05:24 PM   #4
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Re: Teams not working

Yep, it has the features, just you spawn in LV, not on the team, and the cj skin
stormchaser206 is offline   Reply With Quote
Old 19/05/2012, 05:26 PM   #5
iGetty
High-roller
 
iGetty's Avatar
 
Join Date: Sep 2010
Location: Falkirk, Scotland
Posts: 1,753
Reputation: 224
Default Re: Teams not working

Quote:
Originally Posted by stormchaser206 View Post
Yep, it has the features, just you spawn in LV, not on the team, and the cj skin
What do you mean?
iGetty is offline   Reply With Quote
Old 19/05/2012, 05:28 PM   #6
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Re: Teams not working

PS i wa talking to crazy
stormchaser206 is offline   Reply With Quote
Old 19/05/2012, 05:32 PM   #7
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Re: Teams not working

Quote:
Originally Posted by iGetty View Post
Debug it.

USe:

pawn Code:
print("Team [TEAMNAME] works");

Also, try adding "SetPlayerTeam(playerid, TEAM);" under each of the OnPlayerRequestClass things, that might work and remove them from OnPlayerSpawn.

Edit: Max, don't post if you don't know what you're on about. This has nothing to do with his "Server.cfg" file as it's not a filterscript.
Still doesnt work

Would this have anything to do with deleting the classes from the gamemode since there on here?
stormchaser206 is offline   Reply With Quote
Old 19/05/2012, 05:32 PM   #8
iGetty
High-roller
 
iGetty's Avatar
 
Join Date: Sep 2010
Location: Falkirk, Scotland
Posts: 1,753
Reputation: 224
Default Re: Teams not working

Check your PM.
iGetty is offline   Reply With Quote
Old 19/05/2012, 05:37 PM   #9
stormchaser206
Gangsta
 
stormchaser206's Avatar
 
Join Date: Jan 2012
Location: United States of America
Posts: 695
Reputation: 46
Default Re: Teams not working

i posted it there now
stormchaser206 is offline   Reply With Quote
Old 19/05/2012, 05:42 PM   #10
bleedis
Big Clucker
 
bleedis's Avatar
 
Join Date: Jan 2012
Posts: 115
Reputation: 5
Default Re: Teams not working

on top of the script
pawn Code:
static gTeam[MAX_PLAYERS];
and this u know where
pawn Code:
if(classid == 0)
    {
        GameTextForPlayer(playerid, "~b~Team: USA", 6000, 6);
        SetPlayerColor(playerid,COLOR);
        gTeam[playerid] = TEAM_USA;
    }
bleedis is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] [TUT] Teams - Setting up teams - Team restricted vehicles - Team Restricted base retart441 Tutorials 79 08/02/2015 11:43 AM
Help with Teams Ehab1911 Help Archive 2 05/08/2011 09:59 PM
Teams notec100 Help Archive 0 11/04/2009 08:17 PM


All times are GMT. The time now is 08:46 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.