Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

Plugin [Problem] Proszę o pomoc


  • Zamknięty Temat jest zamknięty
7 odpowiedzi w tym temacie

#1 arek_snk

    Zaawansowany

  • Użytkownik

Reputacja: 13
Początkujący

  • Postów:104
  • Lokalizacja:CS
Offline

Napisano 29.03.2010 16:28

Witam!, od niedawna zaczynam uczyć się pisania pluginów do AmxModX, teraz piszę plugin który będzie dawał granaty co 60 sekund... ale mam problem ..

Tutaj daje Plugin :
public grenade_reward()
{
new players[32], player, pnum;
get_players(players, pnum, "a");
for(new i = 0; i < pnum; i++)
{
player = players[i];
if(get_user_flags(player) & ADMIN_LEVEL_H)
{
set_task(0.60, "cs_set_user_bpammo(player, CSW_HEGRENADE, 1)", "b")
}

}
}



A tutaj daje błąd

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Argument type mismatch (argument 3) on line 149

1 Error.
Could not locate output file C:\Documents and Settings\Chalupa\Pulpit\vip2.amx (compile failed).


set_task(0.60, "cs_set_user_bpammo(player, CSW_HEGRENADE, 1)", "b") <-- Linijka 149

Z góry dziękuje za pomoc :))

Pozdrawiam

Użytkownik arek_snk edytował ten post 29.03.2010 16:29

  • +
  • -
  • 0

#2 Owner123

    Wszechpomocny

  • Użytkownik

Reputacja: 146
Zaawansowany

  • Postów:331
  • Lokalizacja:Barty ;]
Offline

Napisano 29.03.2010 17:55

set_task(60.0, "give_grenade", player, _, _, "b")

I zrób funkcje w której gracz bedzie otrzymywal HE bo tak jak ty zrobiles to sie nie da ; ) (chyba).

Użytkownik Owner123 edytował ten post 29.03.2010 20:17

  • +
  • -
  • 0

#3 arek_snk

    Zaawansowany

  • Autor tematu
  • Użytkownik

Reputacja: 13
Początkujący

  • Postów:104
  • Lokalizacja:CS
Offline

Napisano 30.03.2010 00:16

Zrobiłem tak :

public grenade_reward(id)
{
set_task(60.0, "give_grenade", id, _, _, "b")
}


public give_grenade(id)
{
if(get_user_flags(id) & ADMIN_LEVEL_H)
{
fm_give_item(id, "weapon_hegrenade");
fm_give_item(id, "weapon_flashbang");
fm_give_item(id, "weapon_flashbang");
fm_give_item(id, "weapon_smokegrenade");
}
}


Ale nie działa ^.- ?;/
  • +
  • -
  • 0

#4 Portek

    Kończymy zabawę, permanentna emerytura!

  • Przyjaciel

Reputacja: 976
Master

  • Postów:3 007
  • GG:
  • Steam:steam
  • Imię:Michał
  • Lokalizacja:Częstochowa
Offline

Napisano 30.03.2010 07:12

Pokaż całe sma, a nie urywki.
  • +
  • -
  • 0

serwer-1.png
IP: ts3.cserwerek.pl


#5 burnhouse

    Zaawansowany

  • Użytkownik

Reputacja: 11
Początkujący

  • Postów:100
  • Lokalizacja:Dębica, Polska
Offline

Napisano 30.03.2010 07:47

na początku kodu - czyli przed plugin_init dodaj:

#define ADMIN_LEVEL_H

oraz spróbuj (nie wiem czy dobrze) przed if(get_user_flags)... dodaj:

new id
 for(id = 1 ; id <= maxplayers ; id++)

Użytkownik burnhouse edytował ten post 30.03.2010 07:51

  • +
  • -
  • 0

#6 G[o]Q

    I'm G[o]Q

  • Przyjaciel

Reputacja: 1 344
Godlike

  • Postów:3 563
  • Steam:steam
  • Imię:Krzysiek
  • Lokalizacja:C: / program Files / Valve / Cstrike / G[o]Q.dem
Offline

Napisano 30.03.2010 08:01

grenade reward jest chyba eventem wysylanym do all graczy pokaz deklaracje eventu :D
  • +
  • -
  • 0
Manual ponad wszystko, konsola ponad manual :D :&

Chcesz wysłać do mnie PW ? użyj nazwy GoQ zamiast G[o]Q
Chcesz Kupić moduł płatności via Pukawka,Tserwery, Gamesol, Zabijaka do mojego sklepu? napisz PW cena to tylko 10 zł/sztuka

GG:6022845 (nie pomagam za free osobom ponizej rangi MoD) :D

#7 arek_snk

    Zaawansowany

  • Autor tematu
  • Użytkownik

Reputacja: 13
Początkujący

  • Postów:104
  • Lokalizacja:CS
Offline

Napisano 30.03.2010 10:04

#define DAMAGE_RECIEVED
#define MAX_SPAWNS 32

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <engine>

static const COLOR[] = "^x04" //green

new mpd, mkb, mhb
new maxplayers
new g_MsgSync
new health_add
new health_hs_add
new health_max
new nKiller
new nKiller_hp
new nHp_add
new nHp_max
new gmsgSayText
new gPlayer

#if defined DAMAGE_RECIEVED
new g_MsgSync2
#endif

public plugin_init()
{
register_plugin("[VIP] By NeXt", "1.0", "NeXt")
mpd = register_cvar("money_per_damage","0")
mkb = register_cvar("money_kill_bonus","0")
mhb = register_cvar("money_hs_bonus","0")
health_add = register_cvar("amx_vip_hp", "25")
health_hs_add = register_cvar("amx_vip_hp_hs", "25")
health_max = register_cvar("amx_vip_max_hp", "200")
register_clcmd("say /vip","ShowMotd")
maxplayers = get_maxplayers()
gmsgSayText = get_user_msgid("SayText")
register_clcmd("say", "handle_say")
register_logevent("logevent_Round_Start", 2, "1=Round_Start")
register_event("Damage","Damage","b")
register_event("DeathMsg","death_msg","a")
register_event("DeathMsg", "hook_death", "a", "1>0")

maxplayers = get_maxplayers()

register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")

g_MsgSync = CreateHudSyncObj()

#if defined DAMAGE_RECIEVED
g_MsgSync2 = CreateHudSyncObj()
#endif
}

public on_damage(id)
{
new attacker = get_user_attacker(id)

#if defined DAMAGE_RECIEVED
// id should be connected if this message is sent, but lets check anyway
if ( is_user_connected(id) && is_user_connected(attacker) )
if (get_user_flags(attacker) & ADMIN_LEVEL_H)
{
new damage = read_data(2)

set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1)
ShowSyncHudMsg(id, g_MsgSync2, "%i^n", damage)
#else
if ( is_user_connected(attacker) && if (get_user_flags(attacker) & ADMIN_LEVEL_H) )
{
new damage = read_data(2)
#endif
set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
ShowSyncHudMsg(attacker, g_MsgSync, "%i^n", damage)
}
}

public Damage(id)
{
new weapon, hitpoint, attacker = get_user_attacker(id,weapon,hitpoint)
if(attacker<=maxplayers && is_user_alive(attacker) && attacker!=id)
if (get_user_flags(attacker) & ADMIN_LEVEL_H)
{
new money = read_data(2) * get_pcvar_num(mpd)
if(hitpoint==1) money += get_pcvar_num(mhb)
cs_set_user_money(attacker,cs_get_user_money(attacker) + money)
}
}

public death_msg()
{
if(read_data(1)<=maxplayers && read_data(1) && read_data(1)!=read_data(2)) cs_set_user_money(read_data(1),cs_get_user_money(read_data(1)) + get_pcvar_num(mkb) - 300)
}

public logevent_Round_Start()
{
new players[32], player, pnum;
get_players(players, pnum, "a");
for(new i = 0; i < pnum; i++)
{
player = players[i];
if(get_user_flags(player) & ADMIN_LEVEL_H)
{
give_item(player, "weapon_hegrenade");
give_item(player, "weapon_flashbang");
give_item(player, "weapon_flashbang");
give_item(player, "weapon_smokegrenade");
give_item(player, "item_kevlar");
give_item(player, "item_assaultsuit");
give_item(player, "item_thighpack");
set_user_gravity(player, 0.7);
cs_set_user_nvg(player, 1)
set_user_health(player, 200)
set_user_armor(player, 100)
}
}
return PLUGIN_HANDLED
}

public grenade_reward(id)
{
set_task(1.0, "give_grenade", id, _, _, "b")
}

public give_grenade(id)
{
if(get_user_flags(id) & ADMIN_LEVEL_H)
{
cs_set_user_bpammo(id, CSW_HEGRENADE, 1);
cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1);
}
}


public hook_death()
{
// Killer id
nKiller = read_data(1)

if ( (read_data(3) == 1) && (read_data(5) == 0) )
{
nHp_add = get_pcvar_num (health_hs_add)
}
else
nHp_add = get_pcvar_num (health_add)
nHp_max = get_pcvar_num (health_max)
// Updating Killer HP
if(!(get_user_flags(nKiller) & ADMIN_LEVEL_H))
return;
nKiller_hp = get_user_health(nKiller)
nKiller_hp += nHp_add
// Maximum HP check
if (nKiller_hp > nHp_max > gPlayer) nKiller_hp = nHp_max
set_user_health(nKiller, nKiller_hp)
// Hud message "Healed +15/+30 hp"
set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
show_hudmessage(nKiller, "Healed +%d hp", nHp_add)
// Screen fading
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, nKiller)
write_short(1<<10)
write_short(1<<10)
write_short(0x0000)
write_byte(0)
write_byte(0)
write_byte(200)
write_byte(75)
message_end()


}

public ShowMotd(id)
{
show_motd(id, "vip.txt")
}
public client_authorized(id)
{
set_task(30.0, "PrintText" ,id)
}
public PrintText(id)
{
client_print(id, print_chat, "Wpisz w say /vip i dowiedz sie jak zdobyc vipa!.")
}

public client_authorized_dwa(id)
{
set_task(35.0, "PrintTextdwa" ,id)
}
public PrintTextdwa(id)
{
client_print(id, print_chat, "Wpisz w say /vips i zobacz liste vipow w grze.")
}

public handle_say(id) {
new said[192]
read_args(said,192)
if( ( containi(said, "who") != -1 && containi(said, "admin") != -1 ) || contain(said, "/vips") != -1 )
set_task(0.1,"print_adminlist",id)
return PLUGIN_CONTINUE
}

public print_adminlist(user)
{
new adminnames[33][32]
new message[256]
new contactinfo[256], contact[112]
new id, count, x, len

for(id = 1 ; id <= maxplayers ; id++)
if(is_user_connected(id))
if(get_user_flags(id) & ADMIN_LEVEL_H)
get_user_name(id, adminnames[count++], 31)

len = format(message, 255, "%s VIPY ONLINE : ",COLOR)
if(count > 0) {
for(x = 0 ; x < count ; x++) {
len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
if(len > 96 ) {
print_message(user, message)
len = format(message, 255, "%s ",COLOR)
}
}
print_message(user, message)
}
else {
len += format(message[len], 255-len, "Brak VIPOW online.")
print_message(user, message)
}

get_cvar_string("amx_contactinfo", contact, 63)
if(contact[0]) {
format(contactinfo, 111, "%s Contact Server Admin -- %s", COLOR, contact)
print_message(user, contactinfo)
}
}

print_message(id, msg[]) {
message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
write_byte(id)
write_string(msg)
message_end()
}


Tutaj jest cały kod :P

@edit tutaj jest zamiast fm_give_item()
dałem cs_set_user_bpammo <-- ale nie działało :/

Użytkownik arek_snk edytował ten post 30.03.2010 10:05

  • +
  • -
  • 0

#8 G[o]Q

    I'm G[o]Q

  • Przyjaciel

Reputacja: 1 344
Godlike

  • Postów:3 563
  • Steam:steam
  • Imię:Krzysiek
  • Lokalizacja:C: / program Files / Valve / Cstrike / G[o]Q.dem
Offline

Napisano 30.03.2010 15:36

hmm a deklaracja eventu to sie z kosmosu wezmie nie :?:
  • +
  • -
  • 0
Manual ponad wszystko, konsola ponad manual :D :&

Chcesz wysłać do mnie PW ? użyj nazwy GoQ zamiast G[o]Q
Chcesz Kupić moduł płatności via Pukawka,Tserwery, Gamesol, Zabijaka do mojego sklepu? napisz PW cena to tylko 10 zł/sztuka

GG:6022845 (nie pomagam za free osobom ponizej rangi MoD) :D




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych