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

Funkcja - 50% na odrodzenie dla CT.


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

#1 ogury

    Banned

  • Zbanowany

Reputacja: 43
Pomocny

  • Postów:438
  • Lokalizacja:Internet
Offline

Napisano 28.08.2011 09:08

Poszukuję funkcji, która dawałaby 50% szans na odrodzenie w ct. Prosiłbym o gotowy kod, jeżeli można.

#2 speedkill

    Godlike

  • Przyjaciel

Reputacja: 1 592
Godlike

  • Postów:2 733
  • GG:
  • Steam:steam
  • Imię:Michał
  • Lokalizacja:Prudnik
Offline

Napisano 28.08.2011 10:03

Sprawdź
#include <amxmodx>
#include <cstrike>
#include <fun>
public plugin_init() {
register_event("DeathMsg","func_death","a")
}
public func_death()
{
new id = read_data(2)
if ( cs_get_user_team(id) == CS_TEAM_CT )
{
  switch(random_num(1,2))
  {
   case 1:
   {
	spawn(id)
   }
  
   case 2:
   {
	return PLUGIN_HANDLED
   }
  }
}
return PLUGIN_HANDLED
}
Lub tak :
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
public plugin_init() {
register_event("DeathMsg","func_death","a")
}
public func_death()
{
new id = read_data(2)
if ( cs_get_user_team(id) == CS_TEAM_CT )
{
  switch(random_num(1,2))
  {
   case 1:
   {
	ExecuteHamB(Ham_CS_RoundRespawn, id)
   }
  
   case 2:
   {
	return PLUGIN_HANDLED
   }
  }
}
return PLUGIN_HANDLED
}

Użytkownik speedkill123 edytował ten post 28.08.2011 10:05

  • +
  • -
  • 2

If you can dream it, you can do it.


#3 Ortega

    mów mi Orti

  • Power User

Reputacja: 363
Wszechpomocny

  • Postów:640
  • GG:
  • Steam:steam
  • Imię:Marcin
  • Lokalizacja:Sosnowiec
Offline

Napisano 28.08.2011 10:10

Spawn z fun jest nieco zabugowany dlatego użyj ham:
ExecuteHamB( Ham_CS_RoundRespawn, id );

  • +
  • -
  • 1

#4 Skull3D

    Wszechmogący

  • Zbanowany

Reputacja: 102
Zaawansowany

  • Postów:651
  • Imię:Andrzej
  • Lokalizacja:AMXX.PL
Offline

Napisano 28.08.2011 10:13

Proszę:

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

public plugin_init(){
    register_plugin("Odrodzenie", "0.1", "Skull3D");
    
    register_event("DeathMsg", "eventDeath", "a");
}

public eventDeath(){
    new ofiara     =     read_data(2);
    
    if(cs_get_user_team(ofiara) == CS_TEAM_CT ){
   	 switch(random_num(0,100)){
   		 case 0..50:{
   			 ExecuteHamB(Ham_CS_RoundRespawn, ofiara);
   		 }
   		 case 51..100:{ return 1;
   		 }
   	 }
    }
    return 1;
}


#5 ogury

    Banned

  • Autor tematu
  • Zbanowany

Reputacja: 43
Pomocny

  • Postów:438
  • Lokalizacja:Internet
Offline

Napisano 28.08.2011 10:34

Skleiłem to razem z moim pluginem vip, idę testować, na razie wszyscy mają po plusiku.

Kompilacja przebiegła bez błędu, ale plugin nie działa ;<
Logi:
L 08/28/2011 - 11:29:34: [AMXX] Run time error 10 (plugin "vip.amxx") (native "cs_get_user_team") - debug not enabled!
L 08/28/2011 - 11:29:34: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
Plugin:
Spoiler

Mógłbym prosić o poprawienie?

#6 Skull3D

    Wszechmogący

  • Zbanowany

Reputacja: 102
Zaawansowany

  • Postów:651
  • Imię:Andrzej
  • Lokalizacja:AMXX.PL
Offline

Napisano 28.08.2011 10:45

Sprawdź:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <cstrike>
#include <hamsandwich>
 
#define PLUGIN "VIP"
#define VERSION "1.0"
#define AUTHOR "xxx"
 
new player_b_jumpx[33]
new jumps[33]    
new bool:dojump[33]
 
public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_logevent("RoundStart", 2, "0=World triggered", "1=Round_Start");
	register_event("ResetHUD", "resetModel", "b");
	register_event("DeathMsg", "eventDeath", "a");
 
    
	return PLUGIN_CONTINUE
}
 
public client_PreThink ( id )
{
	if ( get_user_flags(id) & ADMIN_LEVEL_H && is_user_alive(id))
	{
		set_user_footsteps(id, 1)
		Prethink_Doublejump(id)
	}
}
 
public Prethink_Doublejump(id)
{
	if(!is_user_alive(id))
		return PLUGIN_HANDLED
    
	if((get_user_button(id) & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(get_user_oldbutton(id) & IN_JUMP))
	{
		if(jumps[id] < player_b_jumpx[id])
		{
     			dojump[id] = true
     			jumps[id]++
     			return PLUGIN_HANDLED
		}
	}
	if((get_user_button(id) & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
	{
		jumps[id] = 0
		return PLUGIN_CONTINUE
	}
    
	return PLUGIN_HANDLED
}
 
public client_PostThink( id )
{
	if (player_b_jumpx[id] > 0) Postthink_Doubeljump(id)    
}
 
public Postthink_Doubeljump(id)
{
	if(!is_user_alive(id))
		return PLUGIN_HANDLED
    
	if(dojump[id] == true)
	{
		new Float:velocity[3]    
		entity_get_vector(id,EV_VEC_velocity,velocity)
		velocity[2] = random_float(265.0,285.0)
		entity_set_vector(id,EV_VEC_velocity,velocity)
		dojump[id] = false
		return PLUGIN_CONTINUE
	}
    
	return PLUGIN_HANDLED
}
 
 
public RoundStart()
{
	for (new i=0; i < 33; i++)
	{    
		if (get_user_flags(i) & ADMIN_LEVEL_H)
		{    
     			if(cs_get_user_team(i) == CS_TEAM_CT)
     			{
             			give_item(i, "weapon_elite")
             			give_item(i,"ammo_9mm")
             			give_item(i,"ammo_9mm")
             			give_item(i,"ammo_9mm")
             			give_item(i,"ammo_9mm")
             			set_user_health (i, 120)
     			}
     			if(cs_get_user_team(i) == CS_TEAM_T)    
     			{
             			give_item(i, "weapon_hegrenade")
             			give_item(i, "weapon_flashbang")
             			set_user_health (i, 155)
             			set_user_armor (i, 100)
     			}
		}
	}
}
    
public eventDeath(){
    	new ofiara  	=   	read_data(2);
    
    	if(get_user_team(ofiara) == 2){
    	switch(random_num(0,100)){
            	case 0..50:{
                    	ExecuteHamB(Ham_CS_RoundRespawn, ofiara);
            	}
            	case 51..100:{ return 1;
            	}
    	}
    	}
    	return 1;
}    
 
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
 

albo

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <cstrike>
#include <hamsandwich>
 
#define PLUGIN "VIP"
#define VERSION "1.0"
#define AUTHOR "xxx"
 
new player_b_jumpx[33]
new jumps[33]    
new bool:dojump[33]
 
public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR);
    register_logevent("RoundStart", 2, "0=World triggered", "1=Round_Start");
    register_event("ResetHUD", "resetModel", "b");
    register_event("DeathMsg", "eventDeath", "a");
    
    
    return PLUGIN_CONTINUE
}
 
public client_PreThink ( id )
{
    if ( get_user_flags(id) & ADMIN_LEVEL_H && is_user_alive(id))
    {
        set_user_footsteps(id, 1)
        Prethink_Doublejump(id)
    }
}
 
public Prethink_Doublejump(id)
{
    if(!is_user_alive(id))
        return PLUGIN_HANDLED
    
    if((get_user_button(id) & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(get_user_oldbutton(id) & IN_JUMP))
    {
        if(jumps[id] < player_b_jumpx[id])
        {
   	     dojump[id] = true
   	     jumps[id]++
   	     return PLUGIN_HANDLED
        }
    }
    if((get_user_button(id) & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
    {
        jumps[id] = 0
        return PLUGIN_CONTINUE
    }
    
    return PLUGIN_HANDLED
}
 
public client_PostThink( id )
{
    if (player_b_jumpx[id] > 0) Postthink_Doubeljump(id)    
}
 
public Postthink_Doubeljump(id)
{
    if(!is_user_alive(id))
        return PLUGIN_HANDLED
    
    if(dojump[id] == true)
    {
        new Float:velocity[3]    
        entity_get_vector(id,EV_VEC_velocity,velocity)
        velocity[2] = random_float(265.0,285.0)
        entity_set_vector(id,EV_VEC_velocity,velocity)
        dojump[id] = false
        return PLUGIN_CONTINUE
    }
    
    return PLUGIN_HANDLED
}
 
 
public RoundStart()
{
    for (new i=0; i < 33; i++)
    {    
        if (get_user_flags(i) & ADMIN_LEVEL_H)
        {    
   	     if(cs_get_user_team(i) == CS_TEAM_CT)
   	     {
   		     give_item(i, "weapon_elite")
   		     give_item(i,"ammo_9mm")
   		     give_item(i,"ammo_9mm")
   		     give_item(i,"ammo_9mm")
   		     give_item(i,"ammo_9mm")
   		     set_user_health (i, 120)
   	     }
   	     if(cs_get_user_team(i) == CS_TEAM_T)    
   	     {
   		     give_item(i, "weapon_hegrenade")
   		     give_item(i, "weapon_flashbang")
   		     set_user_health (i, 155)
   		     set_user_armor (i, 100)
   	     }
        }
    }
}
 
public eventDeath(){
    new ofiara  	=   	read_data(2);
    
    for (new i=0; i < 33; i++)
    {  
        
        if(cs_get_user_team(i) == CS_TEAM_CT)
   	     switch(random_num(0,100)){
   	     case 0..50:{
           	set_task(1.5,"na_respa",ofiara)
   	     }
   	     case 51..100:{ return 1;
   	     }
        }
    }
    return 1;
}    
 
public na_respa()
   		     ExecuteHamB(Ham_CS_RoundRespawn, ofiara);

ja polecam 2 Dołączona grafika

Użytkownik Skull3D edytował ten post 28.08.2011 10:52


#7 Waq

    Zaawansowany

  • Użytkownik

Reputacja: 45
Pomocny

  • Postów:141
  • Imię:Łukasz
  • Lokalizacja:Brak
Offline

Napisano 28.08.2011 10:48

a może tak

/* 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"
new player_b_jumpx[33]
new jumps[33]   
new bool:dojump[33]
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 client_PreThink ( id )
{
	if ( get_user_flags(id) & ADMIN_LEVEL_H && is_user_alive(id))
	{
     	set_user_footsteps(id, 1)
     	Prethink_Doublejump(id)
	}
}
public Prethink_Doublejump(id)
{
	if(!is_user_alive(id))
     	return PLUGIN_HANDLED
   
	if((get_user_button(id) & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(get_user_oldbutton(id) & IN_JUMP))
	{
     	if(jumps[id] < player_b_jumpx[id])
     	{
             	dojump[id] = true
             	jumps[id]++
             	return PLUGIN_HANDLED
     	}
	}
	if((get_user_button(id) & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
	{
     	jumps[id] = 0
     	return PLUGIN_CONTINUE
	}
   
	return PLUGIN_HANDLED
}
public client_PostThink( id )
{
	if (player_b_jumpx[id] > 0) Postthink_Doubeljump(id)   
}
public Postthink_Doubeljump(id)
{
	if(!is_user_alive(id))
     	return PLUGIN_HANDLED
   
	if(dojump[id] == true)
	{
     	new Float:velocity[3]   
     	entity_get_vector(id,EV_VEC_velocity,velocity)
     	velocity[2] = random_float(265.0,285.0)
     	entity_set_vector(id,EV_VEC_velocity,velocity)
     	dojump[id] = false
     	return PLUGIN_CONTINUE
	}
   
	return PLUGIN_HANDLED
}

public Fwd_PlayerSpawn_Post(id)
{
     	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)
             	}
             	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)
             	}
     	}
}
   
public eventDeath(){
    	new ofiara  	=   	read_data(2);
   
    	if(cs_get_user_team(ofiara) == CS_TEAM_CT ){
    	switch(random_num(0,100)){
            	case 0..50:{
                    	ExecuteHamB(Ham_CS_RoundRespawn, ofiara);
            	}
            	case 51..100:{ return 1;
            	}
    	}
    	}
    	return 1;
}   

  • +
  • -
  • 1

#8 Stachuu :D ??

    Wszechobecny

  • Użytkownik

Reputacja: 237
Wszechwidzący

  • Postów:476
  • GG:
  • Steam:steam
  • Imię:Dawid
  • Lokalizacja:Karsznice
Offline

Napisano 28.08.2011 10:50

a ożywienie natychmiastowo po śmierci dobre jest ?
  • +
  • -
  • 1

#9 A może sma?

    Godlike

  • Power User

Reputacja: 546
Wszechwiedzący

  • Postów:1 464
  • Steam:steam
  • Imię:Tomasz
  • Lokalizacja:Polska
Offline

Napisano 28.08.2011 10:56

Chcesz aby tylko gracze w CT mogli się odrodzić, czy gracze z obu teamów mogli się odrodzić, ale na respie CT?


Dopisz debug w plugins.ini za pluginem z vipem, np. vip.amxx debug.


I nie wiem czy wiecie, ale random_num(0,100) losuje liczby od 0 do 100 - co daje łącznie 101 liczb do wylosowania... Więc nie jest to równe 50%.
Po drugie: po co losować od 0 do 100 skoro można losować pomiędzy 0 i 1 i to da ten sam efekt?


Ewentualnie spróbuj takiego DeathMSG: http://amxx.pl/wklej...31452532811795/
  • +
  • -
  • 1

#10 ogury

    Banned

  • Autor tematu
  • Zbanowany

Reputacja: 43
Pomocny

  • Postów:438
  • Lokalizacja:Internet
Offline

Napisano 28.08.2011 10:59

Gotowy plugin nie chce odradzać, czy zaimplementowałby ktoś kod usera a może sma do tego pluginu?
Prosiłbym też odrodzenie 3 sekundy po śmierci.

Użytkownik AX!S edytował ten post 28.08.2011 11:00


#11 sebul

    Godlike

  • Przyjaciel

Reputacja: 2 035
Godlike

  • Postów:5 411
  • Steam:steam
  • Imię:Sebastian
  • Lokalizacja:Ostrołęka
Offline

Napisano 28.08.2011 11:27

Funkcja śmierci powinna wyglądać tak
public eventDeath() {
new ofiara = read_data(2);

if(cs_get_user_team(ofiara) == CS_TEAM_CT && random(100) < 50)
set_task(3.0, "odrodzenie", ofiara);
}

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


  • +
  • -
  • 0

Posiadam TBM (inaczej PTB), które działa dużo lepiej niż zwykłe PTB, nawet na modach z lvlami. Zainteresowany? Proszę bardzo


#12 ogury

    Banned

  • Autor tematu
  • Zbanowany

Reputacja: 43
Pomocny

  • Postów:438
  • Lokalizacja:Internet
Offline

Napisano 28.08.2011 12:33

Nie odradza ;/.

/* 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"   
new bool:dojump[33]
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 Fwd_PlayerSpawn_Post(id)
{
    	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)
            	}
            	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)
            	}
    	}
}

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

public odrodzenie(id)
	ExecuteHamB(Ham_CS_RoundRespawn, id);
Czemu nie chce skompilować?

#13 sebul

    Godlike

  • Przyjaciel

Reputacja: 2 035
Godlike

  • Postów:5 411
  • Steam:steam
  • Imię:Sebastian
  • Lokalizacja:Ostrołęka
Offline

Napisano 28.08.2011 12:34

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!");
}
}

  • +
  • -
  • 0

Posiadam TBM (inaczej PTB), które działa dużo lepiej niż zwykłe PTB, nawet na modach z lvlami. Zainteresowany? Proszę bardzo


#14 ogury

    Banned

  • Autor tematu
  • Zbanowany

Reputacja: 43
Pomocny

  • Postów:438
  • Lokalizacja:Internet
Offline

Napisano 28.08.2011 12:59

30 razy padałem w ct, ani razu żadnego info, ani nic.
k**wa!

#15 sebul

    Godlike

  • Przyjaciel

Reputacja: 2 035
Godlike

  • Postów:5 411
  • Steam:steam
  • Imię:Sebastian
  • Lokalizacja:Ostrołęka
Offline

Napisano 28.08.2011 13:20

Sory, że spytam, ale na pewno dobrze plugin wgrywasz/kompilujesz? Może jakieś logi się tworzą odnośnie tego pluginu?
  • +
  • -
  • 0

Posiadam TBM (inaczej PTB), które działa dużo lepiej niż zwykłe PTB, nawet na modach z lvlami. Zainteresowany? Proszę bardzo


#16 ogury

    Banned

  • Autor tematu
  • Zbanowany

Reputacja: 43
Pomocny

  • Postów:438
  • Lokalizacja:Internet
Offline

Napisano 28.08.2011 13:35

elitki są, hp jest, całe qconsole log (usunięty przed restartem i dodałem "debug" do vip.amxx):
Spoiler

Było "runtime error"




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

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