SA-MP Forums Archive
Message in vehicle - 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: Message in vehicle (/showthread.php?tid=496365)



Message in vehicle - yancarlos4500 - 21.02.2014

Does somebody know a way to send messages to people in the same vehicle.


Re: Message in vehicle - Dignity - 21.02.2014

https://sampforum.blast.hk/showthread.php?tid=79709

Something like this (using zcmd and sscanf):

pawn Код:
CMD:carmsg(playerid, params[])
{
    new string[128], text[100];
       
    if(sscanf(params, "s[100]", text)) return SendClientMessage(playerid, -1, "USAGE: /carmsg [text]");

    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInVehicle(i, GetPlayerVehicleID(playerid)))
            {
                format(string, sizeof(string), "[%s]: %s", GetPlayerName(playerid, string, sizeof(string)), text);
                SendClientMessage(i, -1, string);
                return 1;
            }
        }
    }
    return 1;
}



Re: Message in vehicle - yancarlos4500 - 21.02.2014

Thank You