Small Help
#1

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);
    }
Reply
#2

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
    if(!IsPlayerConnected(i)) continue;
    if(Team[i] == 2 || Team[i] == 4)
    {
        SendClientMessage(i, COLOR, "blah");
    }
}
Reply
#3

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
Reply
#4

yes, ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)