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

Jak dodac do pluginu aby dawalo bron po restarcie


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

#1 NewBorn

    Pomocny

  • Zbanowany

Reputacja: 0
Nowy

  • Postów:70
  • Lokalizacja:Skądś ;) A ty?
Offline

Napisano 18.08.2011 13:36

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()
}


#2 Hiroshima

    Godlike

  • Przyjaciel

Reputacja: 1 327
Godlike

  • Postów:4 984
  • Steam:steam
  • Imię:Michał
  • Lokalizacja:Málaga
Offline

Napisano 18.08.2011 13:42

#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
  • +
  • -
  • 1

#3 NewBorn

    Pomocny

  • Autor tematu
  • Zbanowany

Reputacja: 0
Nowy

  • Postów:70
  • Lokalizacja:Skądś ;) A ty?
Offline

Napisano 18.08.2011 13:46

Sprawdzam

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

#4 Hiroshima

    Godlike

  • Przyjaciel

Reputacja: 1 327
Godlike

  • Postów:4 984
  • Steam:steam
  • Imię:Michał
  • Lokalizacja:Málaga
Offline

Napisano 18.08.2011 14:04

#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
  • +
  • -
  • 1

#5 ;((

    Super Hero

  • Użytkownik

Reputacja: 347
Wszechpomocny

  • Postów:1 157
  • Lokalizacja:Aha
Offline

Napisano 18.08.2011 14:05

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

  • +
  • -
  • 1

#6 NewBorn

    Pomocny

  • Autor tematu
  • Zbanowany

Reputacja: 0
Nowy

  • Postów:70
  • Lokalizacja:Skądś ;) A ty?
Offline

Napisano 18.08.2011 14:08

Dobra zobacze jak wróce macie po +

#7 Hiroshima

    Godlike

  • Przyjaciel

Reputacja: 1 327
Godlike

  • Postów:4 984
  • Steam:steam
  • Imię:Michał
  • Lokalizacja:Málaga
Offline

Napisano 18.08.2011 14:19

@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")
}
}

  • +
  • -
  • 1

#8 DarkGL

    Nie oddam ciasteczka !

  • Administrator

Reputacja: 6 555
Godlike

  • Postów:11 983
  • GG:
  • Steam:steam
  • Imię:Rafał
  • Lokalizacja:Warszawa
Offline

Napisano 18.08.2011 14:23

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

  • +
  • -
  • 2

#9 Goliath

    Godlike

  • Przyjaciel

Reputacja: 1 237
Godlike

  • Postów:2 334
  • GG:
  • Steam:steam
  • Imię:Maciej
  • Lokalizacja:Mońki
Offline

Napisano 18.08.2011 14:24

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

  • +
  • -
  • 2

#10 NewBorn

    Pomocny

  • Autor tematu
  • Zbanowany

Reputacja: 0
Nowy

  • Postów:70
  • Lokalizacja:Skądś ;) A ty?
Offline

Napisano 18.08.2011 18:01

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.

#11 DarkGL

    Nie oddam ciasteczka !

  • Administrator

Reputacja: 6 555
Godlike

  • Postów:11 983
  • GG:
  • Steam:steam
  • Imię:Rafał
  • Lokalizacja:Warszawa
Offline

Napisano 18.08.2011 19:41

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;
}

  • +
  • -
  • 1

#12 NewBorn

    Pomocny

  • Autor tematu
  • Zbanowany

Reputacja: 0
Nowy

  • Postów:70
  • Lokalizacja:Skądś ;) A ty?
Offline

Napisano 18.08.2011 20:10

Teraz działa dzięki :)

#13 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 492
  • Lokalizacja:AMXX.PL
Offline

Napisano 19.08.2011 19:03

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




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

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