Проверка на оружие

pepkernem

Активный
Автор темы
362
74
Как заставить ахк проверить какое у тебя оружие и потом отыграть отыгровку
 
Решение
функция
getPlayerWeaponName() & getPlayerWeaponId()

Пример:
AutoHotKey:
f2::
if(getPlayerWeaponName() = "Combat Shotgun") {
sendchat("/me достал <<Combat Shotgun>>")
}
else {
addchatmessage("Достань дробовик, братик")
}
return

такое себе, на каждое название оружия прописывать отдельные 2 строчки кода
update:
AutoHotKey:
#SingleInstance force
#Persistent
#IfWinActive GTA:SA:MP
#include samp.ahk
SetTimer, update, 500
global last_weap := 0
global last_name := ""

F2::
Reload
return

update:
if(getPlayerWeaponId() = 0){
    if not(last_weap = 0)
        SendChat("спрятал " last_name)
    last_weap := 0
    return
}
if(getPlayerWeaponId() = last_weap)
    return

last_weap := GetPlayerWeaponId()
last_name := getPlayerWeaponName()
SendChat("достал...

meowprd

Тот самый Котовский
Проверенный
1,280
712
функция
getPlayerWeaponName() & getPlayerWeaponId()

Пример:
AutoHotKey:
f2::
if(getPlayerWeaponName() = "Combat Shotgun") {
sendchat("/me достал <<Combat Shotgun>>")
}
else {
addchatmessage("Достань дробовик, братик")
}
return

такое себе, на каждое название оружия прописывать отдельные 2 строчки кода
update:
AutoHotKey:
#SingleInstance force
#Persistent
#IfWinActive GTA:SA:MP
#include samp.ahk
SetTimer, update, 500
global last_weap := 0
global last_name := ""

F2::
Reload
return

update:
if(getPlayerWeaponId() = 0){
    if not(last_weap = 0)
        SendChat("спрятал " last_name)
    last_weap := 0
    return
}
if(getPlayerWeaponId() = last_weap)
    return

last_weap := GetPlayerWeaponId()
last_name := getPlayerWeaponName()
SendChat("достал " last_name)
return
 
Последнее редактирование:
  • Нравится
Реакции: CaJlaT и pepkernem