Small Help - 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: Small Help (
/showthread.php?tid=214549)
Small Help -
marinov - 21.01.2011
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(RandomVehicles[0] <= vehicleid <= RandomVehicles[1] && ispassenger==0)
{
if(Team[playerid] == 1 || Team[playerid] == 2)
{
SendClientMessageToAll(RED,"Someone is entering a vehicle.");
}
}
return 1;
}
It is sending the message to all (ofc), but how do I make it send only for these 2 Teams ?
pawn Код:
if(Team[playerid] == 2)//Guards
{
HideMenuForPlayer(mainmenu, playerid);
SetPlayerColor(playerid, BLUE);
SetPlayerTeam(playerid, 2);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerWeapon(playerid, 24, 300);
GivePlayerWeapon(playerid, 25, 300);
SetPlayerPos(playerid, 826.0, -2073, 12.9);
}
pawn Код:
if(Team[playerid] == 4)//Cops
{
HideMenuForPlayer(mainmenu, playerid);
SetPlayerColor(playerid, GREEN);
SetPlayerTeam(playerid, 4);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 50);
GivePlayerWeapon(playerid, 24, 100);
SetPlayerPos(playerid, 833, -1761, 13.6);
}
Re: Small Help -
Vince - 21.01.2011
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(Team[i] == 2 || Team[i] == 4)
{
SendClientMessage(i, COLOR, "blah");
}
}
Re: Small Help -
[WF]Demon - 21.01.2011
if i understood right you wanted to send the message to only those 2 teams?
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(RandomVehicles[0] <= vehicleid <= RandomVehicles[1] && ispassenger==0)
{
if(Team[playerid] ==1 || Team[playerid] == 2)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(Team[i] == 2 || Team[i] == 4)
{
SendClientMessage(i, RED,"Someone is entering a vehicle.");
}
}
}
}
}
return 1;
}
EDIT
Dang too slow.. either way both will work
Re: Small Help -
marinov - 21.01.2011
yes, ty