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(playeridparams[])
{
    new
    
string[144];
    
format(stringsizeof(string), "%s:  %s"GetPlayerName(playerid), params);
    
SendPlayerMessage(playerid20.0string0xAFAFAFAA0xAFAFAFAA0xAFAFAFAA0xAFAFAFAA0xAFAFAFAA);
    return 
1;
}
SendPlayerMessage(playeridFloat:radius, const text[], color1color2color3color4color5)
{
    foreach(new 
Player)
    {
        if(
IsPlayerInAnyVehicle(i))
        {
            if(
IsNearPlayer(iplayeridradius 16))
            {
                
SendClientMessage(icolor1text);
            }
            else if(
IsNearPlayer(iplayeridradius 8))
            {
                
SendClientMessage(icolor2text);
            }
            else if(
IsNearPlayer(iplayeridradius 4))
            {
                
SendClientMessage(icolor3text);
            }
            else if(
IsNearPlayer(iplayeridradius 2))
            {
                
SendClientMessage(icolor4text);
            }
            else if(
IsNearPlayer(iplayeridradius))
            {
                
SendClientMessage(icolor5text);
            }
        }
    }
}
IsNearPlayer(playeridtargetidFloat:radius)
{
    new
        
Float:x,
        
Float:y,
        
Float:z;
    
GetPlayerPos(targetidxyz);
    if(
IsPlayerInRangeOfPoint(playeridradiusxyz) && 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)