Jump to content

Question

Posted

Nick:Gawitkkk

Problema: Am reusit sa dau de cap unui sistem de Paintball si sa il fac, insa de fiecare data cand sunt in el si sunt omorat, imi da spawn la hq in loc sa imi dea in Paintball.

Erori / warnings: -

Lini/script: -

Ai incercat sa rezolvi singur ?: Da.

18 answers to this question

Recommended Posts

Posted

Păi prima dată faci o matrice cu 4 coloane gen:

[pawn]new Float:RandomSpawnsPaintball[][4] = {

{

    {0.0  0.0, 0.0, 0.0},

    {0.0, 0.0, 0.0, 0.0} // coordonatele spawn

};[/pawn]

Apoi la SetPlayerSpawn (presupun că ai GF / RPG)  foloseşti variabila care spune că eşti în event şi foloseşti funcția pentru spawn random, gen:

[pawn]public SetPlayerSpawn(playerid)

{

    if(IsPlayerConnected(playerid))

    {

        if(StartPaintballEvent[playerid] == 1)

        {

            new rand = random(sizeof(RandomSpawnsPaintball));

            SetPlayerPos(playerid, RandomSpawnsPaintball[rand][0], RandomSpawnsPaintball[rand][1], RandomSpawnsPaintball[rand][2]);

            SetPlayerFacingAngle(playerid, RandomSpawnsPaintball[rand][3]);

        }

    }

    return 1;

}[/pawn]

Pentru funcția random ai aici un link: http://wiki.sa-mp.com/wiki/Random

Posted

Acesta este tot sistemul Paintball.

forward PaintballEnded();
forward StartPaintball();
forward PreparePaintball();

new StartingPaintballRound = 0;
new AnnouncedPaintballRound = 0;
new PaintballPlayers = 0;
new PaintballRound = 0;
new PaintballWinner = 999;
new PaintballWinnerKills = 0;

new PlayerPaintballing[MAX_PLAYERS];
new PlayerPaintballKills[MAX_PLAYERS];

new Float:PaintballSpawns[7][3] = {
{-394.8027,2232.2317,42.4297},
{-430.8412,2240.5371,42.9834},
{-369.2361,2248.3127,42.4844},
{-350.8910,2218.0215,42.4912},
{-384.0544,2206.2908,42.4235},
{-395.7100,2214.9480,42.4297},
{-445.3718,2222.5481,42.4297}
};

public PreparePaintball()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        if(PlayerPaintballing[i] != 0)
	        {
	            SendClientMessage(i, COLOR_YELLOW, "{ee5555}Paintball: {a9c4e4}The match will start in 20 seconds.");
	        }
		}
	}
 	SetTimer("StartPaintball", 20000, 0);
	return 1;
}

public StartPaintball()
{
	PaintballRound = 1;
	StartingPaintballRound = 0;
	PaintballWinner = 999;
	PaintballWinnerKills = 0;
	for(new i = 0; i < MAX_PLAYERS; i++)
 {
	    if(IsPlayerConnected(i))
	    {
	        if(PlayerPaintballing[i] != 0)
	        {
	            ResetPlayerWeaponsEx(i);
	            GivePlayerWeaponEx(i, 29, 999);
	            TogglePlayerControllable(i, 1);
	            SendClientMessage(i, COLOR_YELLOW, "{ee5555}Paintball: {a9c4e4}The match started and it will last 4 days!");
	            PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
	        }
	    }
	}
	SetTimer("PaintballEnded", 240000, 0);
	return 1;
}

public PaintballEnded()
{
	new string[256];
	new name[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        if(PlayerPaintballing[i] != 0)
	        {
	            if(IsPlayerConnected(PaintballWinner))
	            {
	                GetPlayerName(PaintballWinner, name, sizeof(name));
	                format(string,sizeof(string), "{ee5555}Paintball: %s {a9c4e4}won the match with %d kills!",name,PaintballWinnerKills);
	                SendClientMessage(i, COLOR_WHITE, string);
	            }
	            ResetPlayerWeaponsEx(i);
	            PlayerPaintballing[i] = 0;
	            SetPlayerPos(i, SBizzInfo[10][sbEntranceX],SBizzInfo[10][sbEntranceY],SBizzInfo[10][sbEntranceZ]);
	        }
		}
	}
	AnnouncedPaintballRound = 0;
    PaintballRound = 0;
	return 1;
}

	if(PlayerPaintballing[playerid] != 0)
	{
	    PaintballPlayers --;
	}

		else if(PlayerPaintballing[playerid] != 0)
		{
		    //SendClientMessage(playerid, COLOR_WHITE, "Debug4");
		    ResetPlayerWeaponsEx(playerid);
      		GivePlayerWeaponEx(playerid, 29, 999);
		    rand = random(sizeof(PaintballSpawns));
			SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
		    //return 1;
		}

if(PlayerPaintballing[playerid] != 0)
	{
	    PlayerPaintballKills[killerid] ++;
	    if(PlayerPaintballKills[killerid] > PaintballWinnerKills)
	    {
	        new killer[MAX_PLAYER_NAME];
	        PaintballWinner = killerid;
	        PaintballWinnerKills = PlayerPaintballKills[killerid];
	        GetPlayerName(killerid, killer, sizeof(killer));
	        for(new i = 0; i < MAX_PLAYERS; i++)
	        {
	            if(IsPlayerConnected(i))
	            {
	                if(PlayerPaintballing[i] != 0)
	                {
	                    format(string, sizeof(string), "*	%s conduce cu %d Kill-uri.",killer,PaintballWinnerKills);
						SendClientMessage(i, COLOR_WHITE, string);
	                }
	            }
	        }
	    }
	    return 1;
	}

if(StartingPaintballRound == 1 && AnnouncedPaintballRound == 0)
			{
			    AnnouncedPaintballRound = 1;
			    if(PlayerPaintballing[i] != 0)
			    {
			        SendClientMessage(i, COLOR_YELLOW, "Meciul de Paintball v-a incepe in 15 secunde.");
			    }
			}

							if(i == 10)
							{
							    PaintballPlayers ++;
							    PlayerPaintballing[playerid] = 1;
							    new rand = random(sizeof(PaintballSpawns));
								SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
								TogglePlayerControllable(playerid, 0);
							}

							if(i == 10)
							{
							    PaintballPlayers ++;
							    PlayerPaintballing[playerid] = 1;
							    new rand = random(sizeof(PaintballSpawns));
								SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1],                   PaintballSpawns[rand][2]);
								TogglePlayerControllable(playerid, 0);
							}

Si totus, nu inteleg unde este greseala, totul este corect..

Posted

Nu este ciudat, este bun.

Numai ca nu inteleg unde este greseala de nu isi da spawn in paintball, isi da spawn in hq sau in casa..

Posted
		else if(PlayerPaintballing[playerid] != 0)
		{
		    //SendClientMessage(playerid, COLOR_WHITE, "Debug4");
		    ResetPlayerWeaponsEx(playerid);
      		GivePlayerWeaponEx(playerid, 29, 999);
		    rand = random(sizeof(PaintballSpawns));
			SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
		    //return 1;
		} 

Posted

		else if(PlayerPaintballing[playerid] != 0)
		{
		    //SendClientMessage(playerid, COLOR_WHITE, "Debug4");
		    ResetPlayerWeaponsEx(playerid);
      		GivePlayerWeaponEx(playerid, 29, 999);
		    rand = random(sizeof(PaintballSpawns));
			SetPlayerPos(playerid, PaintballSpawns[rand][0], PaintballSpawns[rand][1], PaintballSpawns[rand][2]);
		    //return 1;
		} 

Nu te-ai uitat absolut deloc peste ce ti-am spus X_X.

Posted

Claws e destul de complicat ce spui tu ...

Mergi la comanda pe care o dai tu ca sa intri in paintball si iei coordonatele vezi ca sunt puse cu functia SetPlayerPos si iei acele coordonate .

Creezi o variabila noua nu stiu daca tu ai deja una care sa verifice daca playerul e in paintball dar fa asa daca nu prea sti .

new aGoPaint;
Mergi la comanda de a intra in paintball si adaugi :
aGoPaint[ playerid ] = 1;
Acuma mergi la OnPlayerSpawn si adaugi:
if(aGoPaint[ playerid ] == 1) // asta verifica daca playerul e in paintball
{
  SetPlayerPos(playerid, x ,y , z ); // aici pui coordonatele care le-ai luat de la comanda de paintball vezi ce am mentionat mai sus
}
si la OnPlayerDisconnect adauga:
aGoPaint[ playerid ] = 0;

Posted

Am o problema, imi da urmatoarea eroare:

D:\Scripting\GameMode ExcessRP\gamemodes\excessrp.pwn(2798) : error 028: invalid subscript (not an array or too many subscripts): "aGoPaint"
D:\Scripting\GameMode ExcessRP\gamemodes\excessrp.pwn(2798) : error 017: undefined symbol "playerid"
D:\Scripting\GameMode ExcessRP\gamemodes\excessrp.pwn(2798) : error 029: invalid expression, assumed zero
D:\Scripting\GameMode ExcessRP\gamemodes\excessrp.pwn(2798) : fatal error 107: too many error messages on one line 
La linia:
aGoPaint[playerid] = 1; 

Posted

Nici acum nu merge, imi da urmatoarea eroare:

D:\Scripting\GameMode ExcessRP\gamemodes\excessrp.pwn(2788) : error 017: undefined symbol "playerid" 
La linia:
aGoPaint[ playerid ] = 1; 

Posted

public StartPaintball()
{
	PaintballRound = 1;
	aGoPaint[ playerid ] = 1;
	StartingPaintballRound = 0;
	PaintballWinner = 999;
	PaintballWinnerKills = 0;
	for(new i = 0; i < MAX_PLAYERS; i++)
 {
	    if(IsPlayerConnected(i))
	    {
	        if(PlayerPaintballing[i] != 0)
	        {
	            ResetPlayerWeaponsEx(i);
	            GivePlayerWeaponEx(i, 29, 999);
	            TogglePlayerControllable(i, 1);
	            SendClientMessage(i, COLOR_YELLOW, "{ee5555}Paintball: {a9c4e4}The match started and it will last 4 days!");
	            PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
	        }
	    }
	}
	SetTimer("PaintballEnded", 240000, 0);
	return 1;
} 

Posted

Poftim.

[pawn]

public OnPlayerSpawn(playerid)

{

    if( PlayerPaintballing[ playerid ] == 1 )

    {

        ResetPlayerWeaponsEx( playerid );

  GivePlayerWeaponEx( playerid, 29, 999 );

        rand = random( sizeof( PaintballSpawns ) );

        SetPlayerPos( playerid, PaintballSpawns[ rand ][ 0 ], PaintballSpawns[ rand ][ 1 ], PaintballSpawns[ rand ][ 2 ] );

    }

    //Celelalte coduri

return 1;

}[/pawn]

I'm back bitches.

Posted

Topic Inchis , fara reply in ultimele 48 ore.

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.