Page 1 of 1

ham_use

Posted: 2013 Feb 10 17:12
by MPD
Turiu problemikę. Nežinau kaip padaryti, kad žaidėjui paspaudus mygtuką parašytų 1.
Bandžiau per šitą kodą. Bet vistiek nieko nerašo.
Gal žinote kame bėda? Ar Kaip taisyklingai parašyti kodą?

Code: Select all

 public plugin_init() {    RegisterHam(Ham_Use, "func_button", "OnUse", 1)} public OnUse(ent, idcall, id, use_type, value){    new lazda = find_ent_by_tname(-1, "lazda")    if (ent == lazda)    {        client_print(id, print_chat, "1")    }}

Re: ham_use

Posted: 2013 Feb 10 17:24
by hleV
Gal taip:

Code: Select all

new lazda; while ((lazda = find_ent_by_tname(lazda, "lazda")) > 0){    if (ent != lazda)        continue;     client_print(id, print_chat, "1");     break;}

Re: ham_use

Posted: 2013 Feb 10 17:30
by Tetusis
Try this

Code: Select all

#include <amxmodx>#include <fakemeta>#include <hamsandwich> public plugin_init() {    RegisterHam(Ham_Use, "func_button", "OnUse")} public OnUse(ent, id) {    new target[32]    pev(ent, pev_target, target, charsmax(target))        if (equali(target, "lazda")) {        client_print(id, print_chat, "1")    }}

Re: ham_use

Posted: 2013 Feb 11 08:44
by MPD
Ačiū už pagalbą. Antras kodas veikia kuo puikiausiai.