AHK- Detect Targeted Player ID

Guel

Member
Joined
Aug 8, 2020
Messages
20
Reaction score
1
Location
Philippines
Need an autohotkey that detect the name of the targeted player

For Example :

!1::
(function that gets the id and convert it into name)
SendInput tBows his head in front of (name of the targeted player).{enter}
return
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
475
Solutions
9
Reaction score
168
Location
Poland
PHP:
#SingleInstance Force
#NoEnv
#Include SAMP-UDF-R18.ahk
#IfWinActive GTA:SA:MP
SendMode Input
SetWorkingDir %A_ScriptDir%

Loop
{
    Sleep 30
    while(getTargetPed() > 0)
    {
        if(GetKeyState("RButton", "P"))
        {
            playerId := GetIdByPed(getTargetPed())
            playerName := GetPlayerNameById(playerId)
            AddChatMessage("------------------------------")
            AddChatMessage("{00FF00}playerId: " playerId)
            AddChatMessage("{00FF00}playerName: " playerName)            
            AddChatMessage("------------------------------")
            Sleep 137
            break
        }
    }
}
 

Attachments

  • Guel.rar
    24.5 KB · Views: 12

dphome

Well-known member
Joined
Mar 21, 2020
Messages
475
Solutions
9
Reaction score
168
Location
Poland
PHP:
#SingleInstance Force
#NoEnv
#Include SAMP-UDF-R18.ahk
#IfWinActive GTA:SA:MP
SendMode Input
SetWorkingDir %A_ScriptDir%

!1::
{
    if(getTargetPed() > 0)
    {
        playerId := GetIdByPed(getTargetPed())
        playerName := GetPlayerNameById(playerId)
        SendInput tBows his head in front of %playerName%.{enter}
    }
    else
        ShowGameText("~r~Target not exist", 1337, 5)
}
return
 
Top