CLEO Help Get players name

CLEO related

auma

Member
Joined
Jul 31, 2022
Messages
12
Reaction score
0
I want the code to receive the ID or name of the who is close to me and execute a specific command,

EX: /repairall -> Offer car repair to people close to me
 
Solution
PHP:
{$CLEO .cs}
{$USE bitwise}
0000:
  
WHILE TRUE
WAIT 0

IF 0ADC:   test_cheat "1"
THEN
    IF 0256:   player $PLAYER_CHAR defined
    THEN
        IF 0AB1: @GetClosestPeds 0 0@
        THEN
            IF 0AB1: @SAMPGetPlayerIDByActorHandle 1 _ActorHandle 0@ _Returned: ID 1@
            THEN
                0AC8: 2@ = allocate_memory_size 260                
                0AD3: 2@ = format "/repairall %d" 1@           
                0AB1: @SEND_CMD 2 SampVersionID 3 Text 2@
                0AC9: free_allocated_memory 2@
            END
        END       
    END
END

END
0A93: terminate_this_custom_script

dphome

Well-known member
Joined
Mar 21, 2020
Messages
456
Solutions
9
Reaction score
166
Location
Poland
PHP:
{$CLEO .cs}
{$USE bitwise}
0000:
  
WHILE TRUE
WAIT 0

IF 0ADC:   test_cheat "1"
THEN
    IF 0256:   player $PLAYER_CHAR defined
    THEN
        IF 0AB1: @GetClosestPeds 0 0@
        THEN
            IF 0AB1: @SAMPGetPlayerIDByActorHandle 1 _ActorHandle 0@ _Returned: ID 1@
            THEN
                0AC8: 2@ = allocate_memory_size 260                
                0AD3: 2@ = format "/repairall %d" 1@           
                0AB1: @SEND_CMD 2 SampVersionID 3 Text 2@
                0AC9: free_allocated_memory 2@
            END
        END       
    END
END

END
0A93: terminate_this_custom_script
 

Attachments

  • Script.cs
    24.2 KB · Views: 13
Solution

auma

Member
Joined
Jul 31, 2022
Messages
12
Reaction score
0
PHP:
{$CLEO .cs}
{$USE bitwise}
0000:
  
WHILE TRUE
WAIT 0

IF 0ADC:   test_cheat "1"
THEN
    IF 0256:   player $PLAYER_CHAR defined
    THEN
        IF 0AB1: @GetClosestPeds 0 0@
        THEN
            IF 0AB1: @SAMPGetPlayerIDByActorHandle 1 _ActorHandle 0@ _Returned: ID 1@
            THEN
                0AC8: 2@ = allocate_memory_size 260                
                0AD3: 2@ = format "/repairall %d" 1@           
                0AB1: @SEND_CMD 2 SampVersionID 3 Text 2@
                0AC9: free_allocated_memory 2@
            END
        END       
    END
END

END
0A93: terminate_this_custom_script

thanks, it works great
 

Silent_zzz

Active member
Joined
Feb 1, 2022
Messages
25
Solutions
1
Reaction score
0
Location
a
PHP:
{$CLEO .cs}
{$USE bitwise}
0000:
  
WHILE TRUE
WAIT 0

IF 0ADC:   test_cheat "1"
THEN
    IF 0256:   player $PLAYER_CHAR defined
    THEN
        IF 0AB1: @GetClosestPeds 0 0@
        THEN
            IF 0AB1: @SAMPGetPlayerIDByActorHandle 1 _ActorHandle 0@ _Returned: ID 1@
            THEN
                0AC8: 2@ = allocate_memory_size 260                
                0AD3: 2@ = format "/repairall %d" 1@           
                0AB1: @SEND_CMD 2 SampVersionID 3 Text 2@
                0AC9: free_allocated_memory 2@
            END
        END       
    END
END

END
0A93: terminate_this_custom_script
Can you make a similar one for the cars?
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
456
Solutions
9
Reaction score
166
Location
Poland
"/repair Sultan" - like that?
SA:MP Version?

btw. 0AB1: @SEND_CMD 2 SampVersionID 3 Text 2@
- SampVersionID 3 is for 0.3.DL
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
456
Solutions
9
Reaction score
166
Location
Poland
PHP:
{$CLEO .cs}
0000:
  
WHILE TRUE
WAIT 0

IF 0ADC:   test_cheat "1"
THEN
    IF 0256:   player $PLAYER_CHAR defined
    THEN
        IF 0AB1: @GetClosestVehicle 0 0@
        THEN
            IF 0AB1: @SAMPGetCarIDFromVehicleHandle 1 _VehicleHandle 0@ _StoreCarID 1@
            THEN
                0AC8: 4@ = allocate_memory_size 260
                0441: 3@ = car 0@ model
                0ADB: 4@ = car_model 3@ name                
                0AC8: 2@ = allocate_memory_size 260                
                0AD3: 2@ = format "/repairall %s" 4@           
                0AB1: @SEND_CMD 2 SampVersionID 3 Text 2@
                0AD1: show_formatted_text_highpriority "%s" time 1337 2@ // test
                0AC9: free_allocated_memory 2@
                0AC9: free_allocated_memory 4@
            END
        END       
    END
END

END
0A93: terminate_this_custom_script
 

Attachments

  • Script.cs
    23.6 KB · Views: 6
Top