A RP command only possible in a radius?
#2

pawn Код:
stock MessageToClientsInRadius(playerid, iColor, szString[], Float: fRadius = 5.0) {
    if(!IsPlayerConnected(playerid))
        return 1;

    new
        l_iLocation[2],
        Float: l_fPosition[3];

    GetPlayerPos(playerid, l_fPosition[0], l_fPosition[1], l_fPosition[2]);
    l_iLocation[0] = GetPlayerInterior(playerid);
    l_iLocation[1] = GetPlayerVirtualWorld(playerid);
   
    foreach(Player, i) {
        if(IsPlayerInRangeOfPoint(i, fRadius, l_fPosition[0], l_fPosition[1], l_fPosition[2])) {
            if(GetPlayerVirtualWorld(i) == l_iLocation[1] && GetPlayerInterior(i) == l_iLocation[0]) {
                SendClientMessage(i, iColor, szString);
            }
        }
    }
    return 1;
}

CMD:shout(playerid, params[]) {
    if(isnull(params))
        return SendClientMessage(playerid, 0, "Syntax: /shout [message]");
       
    MessageToClientsInRadius(playerid, 0, params, 25);
    return 1;
}
ProxDetector is slow and outdated.

Try this, I haven't tested it though.

You'll need foreach & zcmd.
Reply


Messages In This Thread
A RP command only possible in a radius? - by justsomeguy - 05.06.2011, 14:43
Re: A RP command only possible in a radius? - by Calgon - 05.06.2011, 14:52
Re: A RP command only possible in a radius? - by Famalamalam - 05.06.2011, 14:53
Re: A RP command only possible in a radius? - by justsomeguy - 05.06.2011, 15:26

Forum Jump:


Users browsing this thread: 2 Guest(s)