[HELP]Filterscript-random puting players in team
#1

Hy!At First I sorry for my bad English..
I have filterscript that i use for Forest TDM Event.. But players dosn't put in teams randomly (i want that)..I want that players who join Event put in Red(Crveni) or Blue(Plavi) team and at finnaly team will be teams to be equalized .. One Friend try to help me but he wasn't help .. He make me 26 Errors -.-' ... I will give you whole my filterscript in hope that You help me...

Код:
#include <a_samp>

new Togforest;



#define TEAM_HIT_COLOR 0xFFFFFF00
#define COLOR_ORANGE 0xFF7700AA
#define BOJA_BILA 0xFFFFFFAA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA

#if defined FILTERSCRIPT



public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print("     Forest Filterscript by Antonio     ");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print("  Forest Filterscript by Antonio    ");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    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);
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

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

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	SetPlayerColor(playerid, COLOR_GRAD2);
	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("/forestoff", cmdtext, true, 10) == 0)
	{
	if(IsPlayerAdmin(playerid))
	{
	for(new i=0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    Togforest = 0;
	}
    }
	}
	return 1;
	}
	if(strcmp("/foreston", cmdtext, true, 10) == 0)
	{
	if(IsPlayerAdmin(playerid))
	{
    Togforest = 1;
    SendClientMessageToAll(COLOR_ORANGE, "Forest: Server is activated Forest TDM. Please type /forest to join.");

    }
	return 1;
	}
	if(strcmp("/unfall", cmdtext, true, 10) == 0)
	{
	if(IsPlayerAdmin(playerid))
	{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
    TogglePlayerControllable(i, 1);
    }
    }
    return 1;
    }
    if (strcmp("/forestcount", cmdtext, true, 10) == 0)
	{
	if(IsPlayerAdmin(playerid))
	{
	Togforest = 0;
	SetTimer("forest", 1000, 0);
	SetTimer("forest1", 2000, 0);
	SetTimer("forest2", 3000, 0);
	SetTimer("forest3", 4000, 0);
	}
    return 1;
    }
    if (strcmp("/forest", cmdtext, true, 10) == 0)                        <---------- This is that command that friend give me and in this command is random puting players in team
{
	if(Togforest == 1)
	{
    SetPlayerInterior(playerid, 0);
    TogglePlayerControllable(playerid,0);
    new rand = random(2);
   	switch(rand)
   	{
   	case 1 : Crveni(playerid);
	case 2 : Plavi(playerid);
 	}
    }
    return true;
}

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;
}
forward forest(playerid);
forward forest1(playerid);
forward forest2(playerid);
forward forest3(playerid);
forward Crveni(playerid);
forward Plavi(playerid);

public forest(playerid)
{
    GameTextForAll("~w~3",2000,3);
    PlayerPlaySound(playerid, 1056, 0.0, 0.0, 10.0);
    return 1;
}

public forest1(playerid)
{
    GameTextForAll("~w~2",2000,3);
    PlayerPlaySound(playerid, 1056, 0.0, 0.0, 10.0);
    return 1;
}

public forest2(playerid)
{
    GameTextForAll("~w~1",2000,3);
    PlayerPlaySound(playerid, 1056, 0.0, 0.0, 10.0);
    return 1;
}

public forest3(playerid)
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
    GameTextForAll("~r~GO! GO! GO!",3000,3);
    TogglePlayerControllable(i,1);
    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 10.0);
    }
    {
    SendClientMessageToAll(COLOR_ORANGE, "Forest: Server is started Forest TDM event.Go in battle (plavi vs crveni / crveni vs plavi).");
    }
    return 1;
}

public Crveni(playerid)
{
    SetPlayerPos(playerid, -840.5459,-1941.6716,12.4118);
	ResetPlayerWeapons(playerid);
	SetPlayerColor(playerid, COLOR_LIGHTRED);
	SetPlayerSkin(playerid, 161);
	GivePlayerWeapon(playerid, 31, 450);
    GivePlayerWeapon(playerid, 24, 450);
	SetPlayerHealth(playerid, 100);
	SetPlayerArmour(playerid, 0);
	TogglePlayerControllable(playerid,0);
  	return 1;
}

public Plavi(playerid)
{
    SetPlayerPos(playerid, -669.2382,-2001.9631,24.7904);
	ResetPlayerWeapons(playerid);
	SetPlayerColor(playerid, COLOR_LIGHTBLUE);
	SetPlayerSkin(playerid, 162);
	GivePlayerWeapon(playerid, 31, 450);
    GivePlayerWeapon(playerid, 24, 157);
	SetPlayerHealth(playerid, 100);
	SetPlayerArmour(playerid, 0);
	TogglePlayerControllable(playerid,0);
  	return 1;
}
And this is photos of 26 errors






Thanks in advance!!
Reply
#2

Change your whole OnPlayerCommandText callback with next:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/forestoff", cmdtext, true, 10) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            for(new i=0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    Togforest = 0;
                }
            }
        }
        return 1;
    }
    if(strcmp("/foreston", cmdtext, true, 10) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            Togforest = 1;
            SendClientMessageToAll(COLOR_ORANGE, "Forest: Server is activated Forest TDM. Please type /forest to join.");
        }
        return 1;
    }
    if(strcmp("/unfall", cmdtext, true, 10) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                TogglePlayerControllable(i, 1);
            }
        }
        return 1;
    }
    if (strcmp("/forestcount", cmdtext, true, 10) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            Togforest = 0;
            SetTimer("forest", 1000, 0);
            SetTimer("forest1", 2000, 0);
            SetTimer("forest2", 3000, 0);
            SetTimer("forest3", 4000, 0);
        }
        return 1;
    }
    if (strcmp("/forest", cmdtext, true, 10) == 0)                        <---------- This is that command that friend give me and in this command is random puting players in team
    {
        if(Togforest == 1)
        {
            SetPlayerInterior(playerid, 0);
            TogglePlayerControllable(playerid,0);
            new rand = random(2);
            switch(rand)
            {
                case 1: Crveni(playerid);
                case 2: Plavi(playerid);
            }
        }
        return 1;
    }
}
You forgot to close the last bracket ( '}' )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)