←  Pytania

AMXX.pl: Support AMX Mod X i SourceMod

»

Jak dodac do pluginu aby dawalo bron po re...

Zablokowany

NewBorn - zdjęcie NewBorn 18.08.2011

Witam mam pytanie jak dodać do tego kodu (jest to kod aby 15 sek po zmienieniu mapy restartowalo runde) zeby po tych 3 restartach dawalo m4 + ammo + all granaty?? Lecą + za pomoc :)
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

#define restartRound() server_cmd("sv_restartround 1")

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

set_task(15.0,"vRestart")
set_task(16.0,"vRestart")
set_task(17.0,"vRestart")
}

public vRestart(){
restartRound()
}
Odpowiedz

  • +
  • -
Hiroshima - zdjęcie Hiroshima 18.08.2011

#include <amxmisc>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

#define restartRound() server_cmd("sv_restartround 1")

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

set_task(15.0,"vRestart")
set_task(16.0,"vRestart")
set_task(17.0,"vRestart")
set_task(18.0,"daj")
}

public vRestart(){
restartRound()
}

public daj() {
give_item(0, "weapon_m4a1")
give_item(0, "ammo_556nato")
give_item(0, "ammo_556nato")
give_item(0, "ammo_556nato")
give_item(0, "ammo_556nato")
give_item(0, "weapon_hegrenade")
give_item(0, "weapon_flashbang")
give_item(0, "weapon_flashbang")
give_item(0, "weapon_smokegrenade")
}

sprawdz
Odpowiedz

NewBorn - zdjęcie NewBorn 18.08.2011

Sprawdzam

Dodano 18 sierpień 2011 - 13:49:
Nie działa ;/
Odpowiedz

  • +
  • -
Hiroshima - zdjęcie Hiroshima 18.08.2011

#include <amxmisc>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

#define restartRound() server_cmd("sv_restartround 1")

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

set_task(15.0,"vRestart")
set_task(16.0,"vRestart")
set_task(17.0,"vRestart")
set_task(18.0,"daj")
}

public vRestart(){
restartRound()
}

public daj(id) {
give_item(id, "weapon_m4a1")
give_item(id, "ammo_556nato")
give_item(id, "ammo_556nato")
give_item(id, "ammo_556nato")
give_item(id, "ammo_556nato")
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
}


w takim razie tak zadziala
Odpowiedz

  • +
  • -
;(( - zdjęcie ;(( 18.08.2011

A to?

#include <amxmisc>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

#define restartRound() server_cmd("sv_restartround 1")

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        
	set_task(15.0,"vRestart")
	set_task(16.0,"vRestart")
	set_task(17.0,"vRestart")
	set_task(18.0,"daj")
}

public vRestart(){
        restartRound()
}

public daj(id) {
	if(is_user_alive(id)){
                give_item(id, "weapon_m4a1")
                give_item(id, "ammo_556nato")
                give_item(id, "ammo_556nato")
                give_item(id, "ammo_556nato")
                give_item(id, "ammo_556nato")
                give_item(id, "weapon_hegrenade")
                give_item(id, "weapon_flashbang")
                give_item(id, "weapon_flashbang")
                give_item(id, "weapon_smokegrenade")
	}
}

Użytkownik DAMIANq edytował ten post 18.08.2011 14:06
Odpowiedz

NewBorn - zdjęcie NewBorn 18.08.2011

Dobra zobacze jak wróce macie po +
Odpowiedz

  • +
  • -
Hiroshima - zdjęcie Hiroshima 18.08.2011

@DAMIANq - jesli juz dajesz taki warunek to moze jeszcze dodasz include?

#include <amxmisc>
#include <amxmodx>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

#define restartRound() server_cmd("sv_restartround 1")

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

set_task(15.0,"vRestart")
set_task(16.0,"vRestart")
set_task(17.0,"vRestart")
set_task(18.0,"daj")
}

public vRestart(){
restartRound()
}

public daj(id) {
if(is_user_alive(id)){
give_item(id, "weapon_m4a1")
give_item(id, "ammo_556nato")
give_item(id, "ammo_556nato")
give_item(id, "ammo_556nato")
give_item(id, "ammo_556nato")
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
}
}
Odpowiedz

  • +
  • -
DarkGL - zdjęcie DarkGL 18.08.2011

w tym co daliście id = 0
a funkcja give_item musi mieć id
static cell AMX_NATIVE_CALL give_item(AMX *amx, cell *params) // native give_item(index, const item[]); = 2 params
{
	/* Gives item to player, name of item can start
	* with weapon_, ammo_ and item_. This event
	* is announced with proper message to all players. */
	// params[1] = index
	// params[2] = item...

	// Check index.
	CHECK_PLAYER(params[1]);

	// Get player pointer.
	edict_t *pPlayer = MF_GetPlayerEdict(params[1]);

	// Create item entity pointer
	edict_t	*pItemEntity;

	// Make an "intstring" out of 2nd parameter
	int length;
	const char *szItem = MF_GetAmxString(amx, params[2], 1, &length);

	//check for valid item
	if (strncmp(szItem, "weapon_", 7) && 
		strncmp(szItem, "ammo_", 5) && 
		strncmp(szItem, "item_", 5) &&
		strncmp(szItem, "tf_weapon_", 10)
	) {
		return 0;
	}

	//string_t item = MAKE_STRING(szItem);
	string_t item = ALLOC_STRING(szItem); // Using MAKE_STRING makes "item" contents get lost when we leave this scope! ALLOC_STRING seems to allocate properly...
	// Create the entity, returns to pointer
	pItemEntity = CREATE_NAMED_ENTITY(item);

	if (FNullEnt(pItemEntity)) {
		MF_LogError(amx, AMX_ERR_NATIVE, "Item \"%s\" failed to create", szItem);
		return 0;
	}

	//VARS(pItemEntity)->origin = VARS(pPlayer)->origin; // nice to do VARS(ent)->origin instead of ent->v.origin? :-I
	//I'm not sure, normally I use macros too =P
	pItemEntity->v.origin = pPlayer->v.origin;
	pItemEntity->v.spawnflags |= SF_NORESPAWN;	//SF_NORESPAWN;

	MDLL_Spawn(pItemEntity);

	int save = pItemEntity->v.solid;

	MDLL_Touch(pItemEntity, ENT(pPlayer));

	//The problem with the original give_item was the
	// item was not removed.  I had tried this but it
	// did not work.  OLO's implementation is better.
	/*
	int iEnt = ENTINDEX(pItemEntity->v.owner);
	if (iEnt > 32 || iEnt <1 ) {
		MDLL_Think(pItemEntity);
	}*/

	if (pItemEntity->v.solid == save) {
		REMOVE_ENTITY(pItemEntity);
		//the function did not fail - we're just deleting the item
		return -1;
	}

	return ENTINDEX(pItemEntity);
}

sprawdź ten kod
#include <amxmodx>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

#define restartRound() server_cmd("sv_restartround 1")

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	set_task(15.0,"vRestart")
	set_task(16.0,"vRestart")
	set_task(17.0,"vRestart")
	set_task(20.0,"daj")
}

public vRestart(){
	restartRound()
}

public daj(){
	for(new id = 1;id<33;id++){
		if(!is_user_alive(id))	continue;
		
		give_item(id, "weapon_m4a1")
		give_item(id, "ammo_556nato")
		give_item(id, "ammo_556nato")
		give_item(id, "ammo_556nato")
		give_item(id, "ammo_556nato")
		give_item(id, "weapon_hegrenade")
		give_item(id, "weapon_flashbang")
		give_item(id, "weapon_flashbang")
		give_item(id, "weapon_smokegrenade")
	}
}
Odpowiedz

  • +
  • -
Goliath - zdjęcie Goliath 18.08.2011

Wasze kody nie będą działać :].
#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

#define restartRound() server_cmd("sv_restartround 1")

public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)

set_task(15.0,"vRestart")
set_task(16.0,"vRestart")
set_task(17.0,"vRestart")
set_task(18.0,"daj")
}

public vRestart(){
restartRound()
}

public daj()
{
for(new id=1; id<33; id++)
{
if(is_user_alive(id))
{
give_item(id, "weapon_m4a1")
give_item(id, "ammo_556nato")
give_item(id, "ammo_556nato")
give_item(id, "ammo_556nato")
give_item(id, "ammo_556nato")
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
}
}
}


EDIT: Damn, uprzedził mnie ^_-
Użytkownik Goliath edytował ten post 18.08.2011 14:26
Odpowiedz

NewBorn - zdjęcie NewBorn 18.08.2011

Ok wszyscy co pomogli macie po + :) Juz sprawdzam kogo działa

Dodano 18 sierpień 2011 - 18:41:
Hmmm tak się składa, że albo coś źle robie albo on nadal nie działa. Dlaczego?

Dodano 18 sierpień 2011 - 18:46:
Juz wiem o co chodzi. Bron i granaty dostaje po 2 restarcie a wiec ona mi sie kasuje za 3 restartem.
Odpowiedz

  • +
  • -
DarkGL - zdjęcie DarkGL 18.08.2011

sprawdź
#include <amxmodx>
#include <hamsandwich>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "DarkGL"

#define restartRound() server_cmd("sv_restartround 1")

new HamHook:pHook;
new iIle = 0;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	set_task(15.0,"vRestart")
	set_task(16.0,"vRestart")
	set_task(17.0,"vRestart")
}

public vRestart(){
	iIle++;
	
	restartRound()
	
	if(iIle == 3){
		pHook = RegisterHam(Ham_Spawn,"player","fwSpawned",1)
		set_task(4.0,"disableHook")
	}
}

public disableHook(){
	DisableHamForward(pHook)
}

public fwSpawned(id){
	if(!is_user_alive(id))
		return HAM_IGNORED;
	
	give_item(id, "weapon_m4a1")
	give_item(id, "ammo_556nato")
	give_item(id, "ammo_556nato")
	give_item(id, "ammo_556nato")
	give_item(id, "ammo_556nato")
	give_item(id, "weapon_hegrenade")
	give_item(id, "weapon_flashbang")
	give_item(id, "weapon_flashbang")
	give_item(id, "weapon_smokegrenade")
	
	return HAM_IGNORED;
}
Odpowiedz

NewBorn - zdjęcie NewBorn 18.08.2011

Teraz działa dzięki :)
Odpowiedz

Adminek AMXX.PL - zdjęcie Adminek AMXX.PL 19.08.2011

Wiadomość wygenerowana automatycznie


Ten temat został zamknięty przez moderatora.

Powód: Rozwiązane

Jeśli się z tym nie zgadzasz, Dołączona grafika raportuj ten post, a moderator lub administrator rozpatrzy go ponownie.


Z pozdrowieniami,
Zespół AMXX.PL
Odpowiedz
Zablokowany