SA-MP Forums Archive
Little favor - 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)
+--- Thread: Little favor (/showthread.php?tid=498443)



Little favor - Lajko1 - 03.03.2014

Can somebody test this for me with friend? All I want to know is if 2 or more players are in same car only they will get message and not other ppl - only ppl in same car.. I can't test with my friends cuz I can't port forward (idk why).

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new car = GetPlayerVehicleID(playerid);
        new str[150], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(str, sizeof(str), "%s(%d) [CAR]: %s", name, playerid, text);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(!IsPlayerConnected(i)) continue;
            if(!IsPlayerInVehicle(i, car)) continue;
            SendClientMessage(i, 0xFFFF00FF, str);
            return 0;
        }
    }
    else //They aren't in a car...
    {
        return 0;
    }
    return 1;
}



Re: Little favor - mamorunl - 03.03.2014

That will print to every person who is in A vehicle. Not necessarily in the same vehicle.


Re: Little favor - Lajko1 - 03.03.2014

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
That will print to every person who is in A vehicle. Not necessarily in the same vehicle.
How to make if they are in same vehicle ? :S Driver and passengers in same vehicle so only they will receive message if they will talk inside of car..


Re: Little favor - Lajko1 - 04.03.2014

So can someone help me with this how to make if players are in same car only they will receive message? Ppl offered me help but none of those scripts ain't working.. last script I used is that one here.