Two teams, How to do this - 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: Two teams, How to do this (
/showthread.php?tid=123610)
Two teams, How to do this -
Torran - 26.01.2010
I have two teams on my server,
One cops, And one crooks,
I want to make it so if you get in a copcar,
And your a cop, It runs the engine system,
But if im a crook, It asks me to hotwire the vehicle,
Ive done it right, But it says Hotwire and engine start,
How to get it to just say Hotwire
My code:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsACopCar(vehicleid))
{
if(GetPlayerTeam(playerid) == TEAM_COPLS)
{
SendClientMessage(playerid, GREEN, "You are in a cop car");
}
else
{
SendClientMessage(playerid, RED, "To hotwire this vehicle Press (Right Mouse Button)");
}
}
}
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(Engine[vehicleid] == 0)
{
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, YELLOW, "Press (Shift) or Type (/engine) to start the vehicles engine");
}
else if(Engine[vehicleid] == 1)
{
SendClientMessage(playerid, GREEN, "Engine Running...");
}
else if(GetPlayerTeam(playerid == 2))
{
if(IsACopCar(vehicleid))
{
SendClientMessage(playerid, YELLOW, "Vehicle Name: Police Car LS");
}
}
}
return 1;
}
Re: Two teams, How to do this -
Mike Garber - 26.01.2010
You have put the gTeam check for cops after the message, this will cause It to first send the message, then check for team.
Move it up.
Re: Two teams, How to do this -
Torran - 26.01.2010
GetPlayerTeam is better, But thats what im doing, It shows both though, I want it to show one