[Help] Team cars - 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: [Help] Team cars (
/showthread.php?tid=268557)
[Help] Team cars -
Twinki1993 - 12.07.2011
Okay guys, I have been making TDM script and I got much help here, I need more help hehe
I wanna make team cars.
Here are some codes how I defined my teams.
new gTeam[MAX_PLAYERS];
#define TEAM_POLICE 1
#define TEAM_GROVE 2
SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0) ///<<<<<<<<<<<<<<<<<<<<<<======================= POLICE
{
gTeam[playerid] = TEAM_POLICE;
SetPlayerTeam(playerid,TEAM_POLICE);//You can delete this line if you want to allow team killing...
GameTextForPlayer(playerid,"~b~Police",5,0);
}
else if(classid == 7) ////////////////////<=======================GROVE STREET
{
gTeam[playerid] = TEAM_GROVE;
SetPlayerTeam(playerid,TEAM_GROVE);//Same for this!
GameTextForPlayer(playerid,"~g~Grove Street",5,0);
}
etc etc...
Can anyone help me with this?
Re: [Help] Team cars -
Vero - 12.07.2011
Put your code in [pawn] tags. Anyway here:
pawn Код:
enum TeamCars
{
car1,
car2,
}
Then you need to set some static vehicles.
pawn Код:
Cars[car1] = AddStaticVehicle(439,2505.6946,-1694.7372,13.4526,2.5337,16,16); // Car at Grove
Cars[car2] = AddStaticVehicle(596,1538.7109,-1644.8483,5.6109,179.1896,0,1); // LSPD Car
And finally
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == 2)
{
new CarCheck = GetPlayerVehicleID(playerid);
if(CarCheck == Cars[car1] )
{
if(gTeam[playerid] == TEAM_GROVE)
{
SendClientMessage(playerid, COLOUR_GREEN, "You are now driving the Grove Car!");
}
else
{
SendClientMessage(playerid, COLOUR_RED, "You do not have the keys for this car!");
RemovePlayerFromVehicle(playerid);
}
}
if(CarCheck == Cars[car2] )
{
if(gTeam[playerid] == TEAM_POLICE)
{
SendClientMessage(playerid, COLOUR_GREEN, "You are now driving the LSPD Car!");
}
else
{
SendClientMessage(playerid, COLOUR_RED, "You do not have the keys for this car!");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
Untested. Be sure to change the colours or you will get errors!
Re: [Help] Team cars -
Twinki1993 - 12.07.2011
How do I know about those teams>? I mean is it like for skins?
Re: [Help] Team cars -
Vero - 12.07.2011
No the one car is set for anyone in Grove and the other is set for anyone in the LSPD. You cannot drive the LSPD Car if you are apart of Grove and vis versa. You just need to add more yourself.
Re: [Help] Team cars -
Twinki1993 - 12.07.2011
Thanks mate!
Re: [Help] Team cars -
Vero - 12.07.2011
No problem.
[HELP]TEAM SYSTEM -
mitsos1997 - 19.07.2011
I NEED SOMEONE TO MAKE ME A TEAM SYSTEM BECAUSE I DONT KNOW HOW ..AND REALLY I NEED THIS TEAM SYSTEM ...PLEASE HELP
Re: [Help] Team cars -
Kitten - 19.07.2011
Quote:
Originally Posted by mitsos1997
I NEED SOMEONE TO MAKE ME A TEAM SYSTEM BECAUSE I DONT KNOW HOW ..AND REALLY I NEED THIS TEAM SYSTEM ...PLEASE HELP
|
easy
pawn Код:
new Team[MAX_PLAYERS];
#define TEAM_1 0
#define TEAM_2 1
if(Team[playerid] == TEAM_1) {
SendClientMessage(playerid,COLOR,"You are team 1");
}
if(Team[playerid] == TEAM_2) {
SendClientMessage(playerid,COLOR,"You are team 2");
}