help with a cmd
#1

Hello, who could help me to make a command, that when I speak only see the people who are driving a car and so the passenger like
for example: /r Hello /r [Text]
That ''Hello'' is seen by people who are in a car, who could help me? or do that command
Reply
#2

Step 1: Check if player in vehicle and store the vehicleid.
Step 2: A player-loop.
Step 3: Check if the value of the loop is in the same vehicle: IsPlayerInVehicle or if GetPlayerVehicleID matches.
Step 4: If they are, send the message.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Step 1: Check if player in vehicle and store the vehicleid.
Step 2: A player-loop.
Step 3: Check if the value of the loop is in the same vehicle: IsPlayerInVehicle or if GetPlayerVehicleID matches.
Step 4: If they are, send the message.
I'm noob in pwn , can you make cmd pls?
Reply
#4

https://sampwiki.blast.hk/wiki/GetPlayerPoolSize
https://sampwiki.blast.hk/wiki/GetPlayerVehicleID
https://sampwiki.blast.hk/wiki/IsPlayerInVehicle

You should at least try. I'll just give you the core:
pawn Код:
// check if player is not in vehicle and return an error..

// format the text you're going to send to passengers/driver of vehicle

new vehicleid = GetPlayerVehicleID(playerid);

for (new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
{
    if (IsPlayerInVehicle(i, vehicleid))
    {
        SendClientMessage(i, color_here, message_here);
    }
}
Reply
#5

PHP код:

CMD
:r(playerid, params[])
{
    new
    
string[144];
    
format(string, sizeof(string), "%s:  %s", GetPlayerName(playerid), params);
    
SendPlayerMessage(playerid, 20.0, string, 0xAFAFAFAA, 0xAFAFAFAA, 0xAFAFAFAA, 0xAFAFAFAA, 0xAFAFAFAA);
    return 
1;
}
SendPlayerMessage(playerid, Float:radius, const text[], color1, color2, color3, color4, color5)
{
    foreach(new 
i : Player)
    {
        if(
IsPlayerInAnyVehicle(i))
        {
            if(
IsNearPlayer(i, playerid, radius / 16))
            {
                
SendClientMessage(i, color1, text);
            }
            else if(
IsNearPlayer(i, playerid, radius / 8))
            {
                
SendClientMessage(i, color2, text);
            }
            else if(
IsNearPlayer(i, playerid, radius / 4))
            {
                
SendClientMessage(i, color3, text);
            }
            else if(
IsNearPlayer(i, playerid, radius / 2))
            {
                
SendClientMessage(i, color4, text);
            }
            else if(
IsNearPlayer(i, playerid, radius))
            {
                
SendClientMessage(i, color5, text);
            }
        }
    }
}
IsNearPlayer(playerid, targetid, Float:radius)
{
    new
        
Float:x,
        
Float:y,
        
Float:z;
    
GetPlayerPos(targetid, x, y, z);
    if(
IsPlayerInRangeOfPoint(playerid, radius, x, y, z) && GetPlayerInterior(playerid) == GetPlayerInterior(targetid) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(targetid))
    {
        return 
1;
    }
    return 
0;
} 
Something like this, if im not wrong.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)