←  Problemy

AMXX.pl: Support AMX Mod X i SourceMod

»

Nie odradza - prośba o poprawienie pluginu.

Zablokowany

ogury - zdjęcie ogury 28.08.2011

http://amxx.pl/wklej...31455445816315/

Wszystko w pluginie działa, oprócz odrodzenia. Nie wiem, z jakiego powodu jest błąd, jeżeli występuje też w innej części kodu, to proszę o poprawienie.

Jeżeli nie działa wklejka:
Spoiler

Użytkownik AX!S edytował ten post 28.08.2011 19:04
Odpowiedz

Skull3D - zdjęcie Skull3D 28.08.2011

Bo tu nawet odrodzenie nie jest dodane.
Odpowiedz

  • +
  • -
Goliath - zdjęcie Goliath 28.08.2011

Zacznijmy od tego, że ten kod się w ogóle nie kompiluje Dołączona grafika. Zobacz teraz.
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "VIP"
#define VERSION "1.0"
#define AUTHOR "xxx"

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1);
register_event("ResetHUD", "resetModel", "b");
register_event("DeathMSG", "eventDeath", "a");
return PLUGIN_CONTINUE
}

public plugin_precache(){
precache_model("models/player/fragusievip/fragusievip.mdl");
precache_model("models/player/dipsy/dipsy.mdl");
precache_generic("models/player/dipsy/dipsyT.mdl");
}

public Fwd_PlayerSpawn_Post(id)
{
if(!is_user_alive(id))
return HAM_IGNORED;

if (get_user_flags(id) & ADMIN_LEVEL_H)
{
if(cs_get_user_team(id) == CS_TEAM_CT)
{
give_item(id, "weapon_elite")
give_item(id,"ammo_9mm")
give_item(id,"ammo_9mm")
give_item(id,"ammo_9mm")
give_item(id,"ammo_9mm")
set_user_health (id, 120)
cs_set_user_model (id, "fragusievip")
}
if(cs_get_user_team(id) == CS_TEAM_T)
{
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
set_user_health (id, 155)
set_user_armor (id, 100)
cs_set_user_model (id, "dipsy")
}
}
return HAM_IGNORED;
}

public eventDeath() {
new ofiara = read_data(2);
if(cs_get_user_team(ofiara) == CS_TEAM_CT)
{
set_task(3.0, "odrodzenie", ofiara);
client_print(ofiara, print_chat, "Odrodzisz sie za 3 sekundy!");
}
}

public odrodzenie(id)
ExecuteHamB(Ham_CS_RoundRespawn, id);
Odpowiedz

  • +
  • -
sebul - zdjęcie sebul 28.08.2011

#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "VIP"
#define VERSION "1.0"
#define AUTHOR "xxx"

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1);
register_event("DeathMSG", "eventDeath", "a");
return PLUGIN_CONTINUE
}

public plugin_precache(){
precache_model("models/player/fragusievip/fragusievip.mdl");
precache_model("models/player/dipsy/dipsy.mdl");
precache_generic("models/player/dipsy/dipsyT.mdl");
}

public Fwd_PlayerSpawn_Post(id)
{
if(!is_user_alive(id))
return HAM_IGNORED;

if (get_user_flags(id) & ADMIN_LEVEL_H)
{
if(cs_get_user_team(id) == CS_TEAM_CT)
{
give_item(id, "weapon_elite")
give_item(id,"ammo_9mm")
give_item(id,"ammo_9mm")
give_item(id,"ammo_9mm")
give_item(id,"ammo_9mm")
set_user_health (id, 120)
cs_set_user_model (id, "fragusievip")
}
else if(cs_get_user_team(id) == CS_TEAM_T)
{
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
set_user_health (id, 155)
set_user_armor (id, 100)
cs_set_user_model (id, "dipsy")
}
}
return HAM_IGNORED;
}

public eventDeath() {
new ofiara = read_data(2);
if(cs_get_user_team(ofiara) == CS_TEAM_CT)
{
set_task(3.0, "odrodzenie", ofiara);
client_print(ofiara, print_chat, "Odrodzisz sie za 3 sekundy!");
}
}

public odrodzenie(id)
ExecuteHamB(Ham_CS_RoundRespawn, id);

Tak chyba będzie lepiej ^ ^
Użytkownik sebul edytował ten post 28.08.2011 19:23
Odpowiedz

ogury - zdjęcie ogury 28.08.2011

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

#define PLUGIN "VIP"
#define VERSION "1.0"
#define AUTHOR "xxx"   

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1);
	register_event("ResetHUD", "resetModel", "b");
	register_event("DeathMSG", "eventDeath", "a");
	return PLUGIN_CONTINUE
}

public plugin_precache(){
	precache_model("models/player/fragusievip/fragusievip.mdl");
	precache_model("models/player/dipsy/dipsy.mdl");
	precache_generic("models/player/dipsy/dipsyT.mdl");
}

public Fwd_PlayerSpawn_Post(id)
{
	if(!is_user_alive(id))
     	return HAM_IGNORED;
    
	if (get_user_flags(id) & ADMIN_LEVEL_H)
	{   
     	if(cs_get_user_team(id) == CS_TEAM_CT)
     	{
             	set_task(0.5, "broniect", id)
     	}
     	if(cs_get_user_team(id) == CS_TEAM_T)   
     	{
   			  set_task(0.5, "broniett", id)
     	}
	}
	return HAM_IGNORED;
}

public eventDeath() {
	new ofiara = read_data(2);
	if(cs_get_user_team(ofiara) == CS_TEAM_CT)
	{
     	set_task(3.0, "odrodzenie", ofiara);
     	client_print(ofiara, print_chat, "Odrodzisz sie za 3 sekundy!");
	}
}

public odrodzenie(id)
	ExecuteHamB(Ham_CS_RoundRespawn, id);
public broniect(id){
give_item(id, "weapon_elite")
             	give_item(id,"ammo_9mm")
             	give_item(id,"ammo_9mm")
             	give_item(id,"ammo_9mm")
             	give_item(id,"ammo_9mm")
             	set_user_health (id, 120)
             	cs_set_user_model (id, "fragusievip")
}
public broniett(id){
give_item(id, "weapon_hegrenade")
             	give_item(id, "weapon_flashbang")
             	set_user_health (id, 155)
             	set_user_armor (id, 100)
             	cs_set_user_model (id, "dipsy")
}
Trochę zmieniłem, bo na niektórych mapach nie było broni, ale i tak nie działa odradzanie.
Odpowiedz

  • +
  • -
Goliath - zdjęcie Goliath 28.08.2011

register_event("ResetHUD", "resetModel", "b"); 

Wywal to i powinno działać.
Użytkownik Goliath edytował ten post 28.08.2011 19:39
Odpowiedz

ogury - zdjęcie ogury 29.08.2011

Powinno, ale nie działa ;(
Spoiler

Użytkownik AX!S edytował ten post 29.08.2011 11:02
opanuj emocje i słownictwo, nie jestes w remizie
Odpowiedz

  • +
  • -
Goliath - zdjęcie Goliath 29.08.2011

Zmień:
register_event("DeathMSG", "eventDeath", "a"); 

Na:
register_event("DeathMsg", "eventDeath", "a"); 
Odpowiedz

Waski - zdjęcie Waski 29.08.2011

Spróbuj tego co podał user wyżej jeżeli nie zadziała to ja coś spróbuje dodać
Odpowiedz

ogury - zdjęcie ogury 29.08.2011

Działa, aczkolwiek chciałbym maksymalnie 1 respawn i 20% na respawn:
Spoiler

Czy 20% tak zadziała? Prosiłbym też o dopisanie maksymalnie jednego respawnu, na razie lecą plusiki.
Odpowiedz

Skull3D - zdjęcie Skull3D 29.08.2011

Masz

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

new odrodzil[33];

public plugin_init()
{
    register_plugin("Vip", "0.1", "AMXX.PL");
    RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1);
    register_event("DeathMsg", "eventDeath", "a");
    return PLUGIN_CONTINUE
}

public plugin_precache(){
    precache_model("models/player/fragusievip/fragusievip.mdl");
    precache_model("models/player/dipsy/dipsy.mdl");
    precache_generic("models/player/dipsy/dipsyT.mdl");
}

public Fwd_PlayerSpawn_Post(id)
{
    if(!is_user_alive(id))
   	 return HAM_IGNORED;
    
    if (get_user_flags(id) & ADMIN_LEVEL_H)
    {  
   	 if(cs_get_user_team(id) == CS_TEAM_CT)
   	 {
   		 set_task(0.5, "broniect", id)
   	 }
   	 if(cs_get_user_team(id) == CS_TEAM_T)  
   	 {
   		 set_task(0.5, "broniett", id)
   	 }
    }
    
    return HAM_IGNORED;
}

public eventDeath() {
    new ofiara = read_data(2);
    if(cs_get_user_team(ofiara) == CS_TEAM_CT)
    {
   	 switch(random_num(1,5))
   	 {
   		 case 1: {
   			 set_task(3.0, "odrodzenie", ofiara);
   			 client_print(ofiara, print_chat, "Odrodzisz sie za 3 sekundy!");
   			 
   			 odrodzil[ofiara] = true;
   		 }
   		 default: {
   			 return 0;
   		 }
   	 }
    }
    return 1;
}

public odrodzenie(id)
    ExecuteHamB(Ham_CS_RoundRespawn, id);

public broniect(id){
    give_item(id, "weapon_elite")
    give_item(id,"ammo_9mm")
    give_item(id,"ammo_9mm")
    give_item(id,"ammo_9mm")
    give_item(id,"ammo_9mm")
    set_user_health (id, 120)
    cs_set_user_model (id, "fragusievip")
}
public broniett(id){
    give_item(id, "weapon_hegrenade")
    give_item(id, "weapon_flashbang")
    set_user_health (id, 155)
    set_user_armor (id, 100)
    cs_set_user_model (id, "dipsy")
}

Użytkownik Skull3D edytował ten post 29.08.2011 14:26
Odpowiedz

mierzwi - zdjęcie mierzwi 29.08.2011

nie może być odrodzil[id] = false;tam gdzie się odradza no pozdro skull3d, daj w newround, 2 to switch, daj na randomy 1,5 i daj case 1: respawn a default: plugin_continue;
Użytkownik funfel edytował ten post 29.08.2011 14:27
Odpowiedz

Skull3D - zdjęcie Skull3D 29.08.2011

A no tak.
Jest zarejestrowanie spawna a ja myślalem że nowej rundy edit :)
Odpowiedz

mierzwi - zdjęcie mierzwi 29.08.2011

dodaj event na nowa runde jeszcze inew odrodzil[33];to chyba ma byc bool ? D:
Odpowiedz

Skull3D - zdjęcie Skull3D 29.08.2011

bez boola dziala bo ja tak robilem ale ja niewiem czy ma odradzac raz na mape czy raz na runde i nie rejestrowalem

A tu masz kod że można odrodzić raz na runde

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

new odrodzil[33];

public plugin_init(){
	register_plugin("Vip", "0.1", "AMXX.PL");
    
	RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1);
    
	register_event("DeathMsg", "eventDeath", "a");
    
	register_logevent("event_RoundStart",2,"1=Round_Start");    

}

public plugin_precache(){
	precache_model("models/player/fragusievip/fragusievip.mdl");
	precache_model("models/player/dipsy/dipsy.mdl");
	precache_generic("models/player/dipsy/dipsyT.mdl");
}

public event_RoundStart(id){
    new iPlayers[32], iNum;
    get_players(iPlayers, iNum);
    
    for(new g = 0; g<iNum ;g++){
   	 
   	 odrodzil[id] = false;
    }
}


public Fwd_PlayerSpawn_Post(id)
{
	if(!is_user_alive(id))
     	return HAM_IGNORED;
    
	if (get_user_flags(id) & ADMIN_LEVEL_H)
	{  
     	if(cs_get_user_team(id) == CS_TEAM_CT)
     	{
             	set_task(0.5, "broniect", id)
     	}
     	if(cs_get_user_team(id) == CS_TEAM_T)  
     	{
             	set_task(0.5, "broniett", id)
     	}
	}
    
	return HAM_IGNORED;
}

public eventDeath() {
	new ofiara = read_data(2);
	if(cs_get_user_team(ofiara) == CS_TEAM_CT)
	{
     	switch(random_num(1,5))
     	{
             	case 1: {
                     	set_task(3.0, "odrodzenie", ofiara);
                     	client_print(ofiara, print_chat, "Odrodzisz sie za 3 sekundy!");
                    	 
                     	odrodzil[ofiara] = true;
             	}
             	default: {
                     	return 0;
             	}
     	}
	}
	return 1;
}

public odrodzenie(id)
	ExecuteHamB(Ham_CS_RoundRespawn, id);

public broniect(id){
	give_item(id, "weapon_elite")
	give_item(id,"ammo_9mm")
	give_item(id,"ammo_9mm")
	give_item(id,"ammo_9mm")
	give_item(id,"ammo_9mm")
	set_user_health (id, 120)
	cs_set_user_model (id, "fragusievip")
}
public broniett(id){
	give_item(id, "weapon_hegrenade")
	give_item(id, "weapon_flashbang")
	set_user_health (id, 155)
	set_user_armor (id, 100)
	cs_set_user_model (id, "dipsy")
}

Użytkownik Skull3D edytował ten post 29.08.2011 14:37
Odpowiedz

  • +
  • -
sebul - zdjęcie sebul 29.08.2011

Dołączona grafika dłuższego kodu do takiej rzeczy nie dało się zrobić...? Wcześniejsze kody były dobre, więc nie wiem czemu niby nie działają, ale może spróbuj jeszcze tego
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "VIP"
#define VERSION "1.0"
#define AUTHOR "xxx"


new bool:odrodzil[33];

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1);
register_event("DeathMSG", "eventDeath", "a");
register_event("HLTV", "Nowa_Runda", "a", "1=0", "2=0");
}

public plugin_precache(){
precache_model("models/player/fragusievip/fragusievip.mdl");
precache_model("models/player/dipsy/dipsy.mdl");
}

public Fwd_PlayerSpawn_Post(id)
{
if(!is_user_alive(id))
return HAM_IGNORED;

if (get_user_flags(id) & ADMIN_LEVEL_H)
set_task(0.5, "bronie", id)

return HAM_IGNORED;
}

public bronie(id) {
if(cs_get_user_team(id) == CS_TEAM_CT)
{
give_item(id, "weapon_elite")
give_item(id,"ammo_9mm")
give_item(id,"ammo_9mm")
give_item(id,"ammo_9mm")
give_item(id,"ammo_9mm")
set_user_health (id, 120)
cs_set_user_model (id, "fragusievip")
}
else if(cs_get_user_team(id) == CS_TEAM_T) {
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
set_user_health (id, 155)
set_user_armor (id, 100)
cs_set_user_model (id, "dipsy")
}
}

public Nowa_Runda()
for(new i=1; i<=32; i++)
if(odrodzil[i]) odrodzil[i] = false;

public eventDeath() {
new ofiara = read_data(2);
if(cs_get_user_team(ofiara) == CS_TEAM_CT && !odrodzil[ofiara] && random(5) == 0)
{
set_task(3.0, "odrodzenie", ofiara);
client_print(ofiara, print_chat, "Odrodzisz sie za 3 sekundy!");

odrodzil[ofiara] = true;
}
}

public odrodzenie(id)
if(is_user_connected(id) && !is_user_alive(id))
ExecuteHamB(Ham_CS_RoundRespawn, id);


Teraz doczytałem co autor tematu napisał wyżej, ale takie rzeczy chyba pisze się od razu w pierwszym poście...

Jeszcze mała literówka była.

A jeszcze co do kodu wyżej, to nawet nie ma prawa on działać, przy nowej rundzie niby skąd te id? I nie dodałeś, żeby sprawdzało przy śmierci, czy gracz był już odradzany.
Użytkownik sebul edytował ten post 29.08.2011 15:15
Odpowiedz
Zablokowany