Checkpoint (for a team)
#1

Hello
I am learning pawn language and was working on very first FS (random fire) is it possible to set a checkpoint for a team(faction) like when there is a fire all the member of faction will get notified about it and a checkpoint on their map will be placed
Thankyou
Reply
#2

Yes, its possible. You can use https://sampwiki.blast.hk/wiki/SetPlayerTeam & https://sampwiki.blast.hk/wiki/GetPlayerTeam

So you could like send a client message if players are of a same team. Although, I'm not sure about checkpoints... I think its possible.
Reply
#3

Can you let me know that how to send client message according to different case
Код:
case 0:
		{
			CreateExplosion(1372.5750,-1100.7531,24.4141, 1, 20.0);
			CreateExplosion(1369.2709,-1101.0941,24.0747, 1, 20.0);
			CreateExplosion(1367.2919,-1097.7124,24.1590, 1, 20.0);
			CreateExplosion(1190.3094,-1379.0020,13.5215, 1, 20.0);
			CreateExplosion(1188.5924,-1376.0232,13.5362, 1, 20.0);
		}
		case 1:
		{
			CreateExplosion(1937.5554,-1763.3531,13.3828, 2, 20.0); // Area 0 - Idlewood
			CreateExplosion(1945.7601,-1765.4830,13.3828, 2, 20.0);
			CreateExplosion(1945.0408,-1774.3759,13.3906, 2, 20.0);
			CreateExplosion(1945.1576,-1784.9263,13.3828, 2, 20.0);
			CreateExplosion(1937.9746,-1785.5255,13.3906, 2, 20.0);
			CreateExplosion(1932.7399,-1778.2761,13.3828, 2, 20.0);
			CreateExplosion(1925.2346,-1779.3983,17.9766, 2, 20.0);
			CreateExplosion(1929.7230,-1789.8518,13.3828, 2, 20.0);
			CreateExplosion(1941.6704,-1784.5291,13.3906, 2, 20.0);
			CreateExplosion(1951.5349,-1780.0042,13.5469, 2, 20.0);
		}
	}
Reply
#4

If you use SetPlayerTeam, team damage is disabled...

Best to use a TeamID on the enum for the players, and simply go through each player with foreach checking for the team, and sending the message that way.
Reply
#5

You can also create some kind of pickup where a player can go on and off duty.
When the player goes on duty, set an array to 1 for example.
You can then loop trough players and send a message to whoever is on fire fighter duty.

PHP код:
new FireFighterDuty[MAX_PLAYERS];
    for(new 
i=0i<GetMaxPlayers(); i++)
    {
        if(
FireFighterDuty[i] == 1)
        {
            
SetPlayerCheckpoint(i,,1);
            
SendClientMessage(i, -1"A fire has been reported! A waypoint has been set on your map.");
        }
    } 
So whenever a player goes on fire duty, this is what you need to do with the value of the array.

PHP код:
FireFighterDuty[playerid] = 1
And when the player turns off the duty

PHP код:
FireFighterDuty[playerid] = 0
Reply
#6

error 017: undefined symbol "i"
Код:
numMedicsOnline(onduty = 1) {
	new num, faction;
	foreach(Player, i) {
		if(IsPlayerConnectEx(i)) {
			faction = GetPVarInt(i, "Faction");
			if(getFactionType(faction) == EFactionType_EMS) {
				if(!onduty || isOnMedicDuty(i)) {
					num++;
Reply
#7

foreach(Player, i)
to

foreach(new i : Player)
Reply
#8

still the same error 017: undefined symbol "i"
Reply
#9

which include is it?

y_iterate
or
foreach?

which version of any include are you using?
Reply
#10

foreach mpl 1.1
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)