SA-MP Forums Archive
How to...? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to...? (/showthread.php?tid=126444)



How to...? - Rubennnnn - 08.02.2010

I'm making a Farmers'n'Stealers GM and how to make a checkpoint for the player who's on the tractor for a specified team?
I've got TEAM_FARMER and TEAM_ATTACKER and how to make a checkpoint that shows up when a player from TEAM_FARMER is on the tractor and the other way around? And it's only enterable with the vehicle model id 531.


Re: How to...? - TTJJ - 08.02.2010

Hi there Rubennnnn,

If I understand you correctly, you basically want a checkpoint for all players on the oposite team to appear when someone gets onto a tractor.

Simple way to do this:

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	new veh = GetVehicleModel(vehicleid);
	if(veh == 531)
	{
		for(new i=0; i<MAX_PLAYERS; i++)
  	{
    	if(IsPlayerConnected(i))
    	{
    	 		if(TEAM_VARIABLE[i] != TEAM_VARIABLE[playerid])
       	{
        	 new Float:X, Float:Y, Float:Z;
        	 GetPlayerPos(playerid,X,Y,Z);
        	 SetPlayerCheckpoint(i,X,Y,Z);
				}
			}
		}
	}
	return 1;
}
Thats just something I quickly put together, so forgive me if there are any errors, give it a try see what happens.

Cheers,

TJ


Re: How to...? - Rubennnnn - 08.02.2010

Quote:
Originally Posted by TTJJ
Hi there Rubennnnn,

If I understand you correctly, you basically want a checkpoint for all players on the oposite team to appear when someone gets onto a tractor.

Simple way to do this:

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	new veh = GetVehicleModel(vehicleid);
	if(veh == 531)
	{
		for(new i=0; i<MAX_PLAYERS; i++)
  	{
    	if(IsPlayerConnected(i))
    	{
   	 		if(TEAM_VARIABLE[i] != TEAM_VARIABLE[playerid])
      	{
        	 new Float:X, Float:Y, Float:Z;
        	 GetPlayerPos(playerid,X,Y,Z);
        	 SetPlayerCheckpoint(i,X,Y,Z);
				}
			}
		}
	}
	return 1;
}
Thats just something I quickly put together, so forgive me if there are any errors, give it a try see what happens.

Cheers,

TJ
C:\Users\Ruben\Desktop\GTA SA MP server\gamemodes\farmer.pwn(161) : error 029: invalid expression, assumed zero
C:\Users\Ruben\Desktop\GTA SA MP server\gamemodes\farmer.pwn(161) : error 029: invalid expression, assumed zero
C:\Users\Ruben\Desktop\GTA SA MP server\gamemodes\farmer.pwn(161) : warning 215: expression has no effect
C:\Users\Ruben\Desktop\GTA SA MP server\gamemodes\farmer.pwn(161) : error 001: expected token: ";", but found "]"
C:\Users\Ruben\Desktop\GTA SA MP server\gamemodes\farmer.pwn(161) : fatal error 107: too many error messages on one line

it has to do with if(TEAM_FARMER[i] != TEAM_ATTACKER[playerid])


Re: How to...? - TTJJ - 08.02.2010

Ahh I see, I think I may have misunderstood you.
I assumed you had a global variable for each player? That is assigned to their team when they choose a class... Is that correct or do you have something different?



Re: How to...? - Rubennnnn - 09.02.2010

Quote:
Originally Posted by TTJJ
Ahh I see, I think I may have misunderstood you.
I assumed you had a global variable for each player? That is assigned to their team when they choose a class... Is that correct or do you have something different?
yes, that's correct


Re: How to...? - Rubennnnn - 10.02.2010

..


Re: How to...? - XeoN_13 - 10.02.2010

Quote:
Originally Posted by Rubennnnn
..
Why make useless post's?


Re: How to...? - TTJJ - 10.02.2010

Can you post what how you re-wrote it to suit the variables? Then I may be able to get an idea of why its going wrong


Re: How to...? - Rubennnnn - 10.02.2010

I just edited if(TEAM_VARIABLE[i] != TEAM_VARIABLE[playerid]) to if(TEAM_FARMER[i] != TEAM_ATTACKER[playerid])