Mine sisusse
Otsi siit
  • Rohkem valikuid...
Otsi tulemusi mis sisaldab...
Otsi tulemusi...
Jälgi teemat sisse logides  

Üks script vajab natukene muutmist

Soovitatud postitused

VIP

Script on siis Santa Hat script. Hetkel scriptis saavad kõik playerid santa hati, aga tahaks, et santa hati saaksid vaid VIP, ADMIN ja IMMUADMIN. Ehk mängijad, kellel on: p,q,r või s õigus. Oleks tore ka, kui lisaksite scripti ka selle, et santa hat tuleb siis, kui kirjutad /lisahat ja hati saab ka ära võtta, kirjutades /eemaldahat. Oleks tore, kui keegi teeks selle ümber.

Algne kood siis:

 

#include 
#include 
#include 

new g_Enable;
new g_bwEnt[33];
new g_CachedStringInfoTarget;

public plugin_init() {
register_plugin( "Santa Hat", "1.2", "xPaw" );
register_cvar("santa_hat", "1.2", FCVAR_SERVER);
g_Enable = register_cvar("amx_santahat", "1");

RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
g_CachedStringInfoTarget = engfunc( EngFunc_AllocString, "info_target" );
}

public plugin_precache()
precache_model("models/santa_hat.mdl");

public fwHamPlayerSpawnPost( const player ) {
if ( get_pcvar_num( g_Enable ) && is_user_alive( player ) ) {
	new iEnt = g_bwEnt[ player ];
	if( !pev_valid( iEnt ) ) {
		g_bwEnt[ player ] = iEnt = engfunc ( EngFunc_CreateNamedEntity, g_CachedStringInfoTarget );
		set_pev( iEnt, pev_movetype, MOVETYPE_FOLLOW );
		set_pev( iEnt, pev_aiment, player );
		engfunc( EngFunc_SetModel, iEnt, "models/santa_hat.mdl" );
	}
}
}

Jaga seda postitust


Postituse link
Share on other sites

Ei usu, et toimib aga proovida võib. Commandeid ma ei lisanud.

#include 
#include 
#include 

#define ADMINACCESs ADMIN_LEVEL_G

new g_Enable;
new g_bwEnt[33];
new g_CachedStringInfoTarget;

public plugin_init() {
register_plugin( "Santa Hat", "1.2", "xPaw" );
register_cvar("santa_hat", "1.2", FCVAR_SERVER);
g_Enable = register_cvar("amx_santahat", "1");

RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
g_CachedStringInfoTarget = engfunc( EngFunc_AllocString, "info_target" );
}

public plugin_precache()
precache_model("models/santa_hat.mdl");

public fwHamPlayerSpawnPost( const player ) {
if ( get_pcvar_num( g_Enable ) && is_user_alive( player ) ) && (!access(id,ADMINACCESS))  {
	new iEnt = g_bwEnt[ player ];
	if( !pev_valid( iEnt ) ) {
		g_bwEnt[ player ] = iEnt = engfunc ( EngFunc_CreateNamedEntity, g_CachedStringInfoTarget );
		set_pev( iEnt, pev_movetype, MOVETYPE_FOLLOW );
		set_pev( iEnt, pev_aiment, player );
		engfunc( EngFunc_SetModel, iEnt, "models/santa_hat.mdl" );
	}
}
}

 

---------- Post added 07-12-11 at 20:28 ----------

 

s flagi peale panin

Jaga seda postitust


Postituse link
Share on other sites
VIP
Author of the topic Postitas

Oleks vaja, et kõik inimesed, kellel on kas p,q,r või s õigus, saaks seda kasutada, mitte ainult s õigusega inimene. Aitäh

Jaga seda postitust


Postituse link
Share on other sites

qwas see on tema server ja taha tahab niimoodi lisaks, sinu kood kontrollib, et EI oleks kasutajal s flaggi.

 

PS: Pole testitud :)

 

#include 
#include 
#include 

#DEFINE P_ACCESS	ADMIN_LEVEL_D
#DEFINE Q_ACCESS	ADMIN_LEVEL_E
#DEFINE R_ACCESS	ADMIN_LEVEL_F
#DEFINE S_ACCESS	ADMIN_LEVEL_G

new g_Enable;
new g_bwEnt[33];
new g_CachedStringInfoTarget;

public plugin_init() {
register_plugin("Santa Hat", "1.2", "xPaw");
register_cvar("santa_hat", "1.2", FCVAR_SERVER);
g_Enable = register_cvar("amx_santahat", "1");

RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
g_CachedStringInfoTarget = engfunc( EngFunc_AllocString, "info_target" );
}

public plugin_precache()
precache_model("models/santa_hat.mdl");

public fwHamPlayerSpawnPost(const player) {
if(get_pcvar_num(g_Enable) && is_user_alive(player) && get_user_flags(player) & P_ACCESS && get_user_flags(player) & Q_ACCESS 
&& get_user_flags(player) & R_ACCESS && get_user_flags(player) & S_ACCESS) {
	new iEnt = g_bwEnt[player];
	if(!pev_valid(iEnt)) {
		g_bwEnt[player] = iEnt = engfunc (EngFunc_CreateNamedEntity, g_CachedStringInfoTarget);
		set_pev(iEnt, pev_movetype, MOVETYPE_FOLLOW);
		set_pev(iEnt, pev_aiment, player);
		engfunc(EngFunc_SetModel, iEnt, "models/santa_hat.mdl");
	}
}
}

Jaga seda postitust


Postituse link
Share on other sites
VIP
Author of the topic Postitas

s on omaniku õigus. Kui s õigusega inimeni joinib, tuleb kiri ka, et omanik liitus. Mul on eraldi need õigused.

Jaga seda postitust


Postituse link
Share on other sites
VIP
Author of the topic Postitas

Jep. Panen kohe peale. Aga mingi jama vist, sest see esimene script ei tööta. :( VB mul midagi valesti. Hetkel nii, et serverisse saab tulla, tiimi saab valida, aga mäng ei alga.. Milles probleem?

 

---------- Post added 08-12-11 at 16:47 ----------

 

Compileda ka ei lase, kuna error.

/tmp/texteLJlz0.sma(5) : error 031: unknown directive
/tmp/texteLJlz0.sma(27) : error 017: undefined symbol "P_ACCESS"

Jaga seda postitust


Postituse link
Share on other sites

Väike trükiviga oli.

 

#include 
#include 
#include 

#define P_ACCESS	ADMIN_LEVEL_D
#define Q_ACCESS	ADMIN_LEVEL_E
#define R_ACCESS	ADMIN_LEVEL_F
#define S_ACCESS	ADMIN_LEVEL_G

new g_Enable;
new g_bwEnt[33];
new g_CachedStringInfoTarget;

public plugin_init() {
register_plugin("Santa Hat", "1.2", "xPaw");
register_cvar("santa_hat", "1.2", FCVAR_SERVER);
g_Enable = register_cvar("amx_santahat", "1");

RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
g_CachedStringInfoTarget = engfunc( EngFunc_AllocString, "info_target" );
}

public plugin_precache()
precache_model("models/santa_hat.mdl");

public fwHamPlayerSpawnPost(const player) {
if(get_pcvar_num(g_Enable) && is_user_alive(player) && get_user_flags(player) & P_ACCESS && get_user_flags(player) & Q_ACCESS 
&& get_user_flags(player) & R_ACCESS && get_user_flags(player) & S_ACCESS) {
	new iEnt = g_bwEnt[player];
	if(!pev_valid(iEnt)) {
		g_bwEnt[player] = iEnt = engfunc (EngFunc_CreateNamedEntity, g_CachedStringInfoTarget);
		set_pev(iEnt, pev_movetype, MOVETYPE_FOLLOW);
		set_pev(iEnt, pev_aiment, player);
		engfunc(EngFunc_SetModel, iEnt, "models/santa_hat.mdl");
	}
}
}

Jaga seda postitust


Postituse link
Share on other sites
VIP
Author of the topic Postitas

Mis valesti oli?

Ma testin kohe pluginat. :D

 

---------- Post added 08-12-11 at 17:33 ----------

 

Panin plugina peale ja santa_hat.mdl ka, script vist töötab, aga mütse peas pole. :(

Milles võib viga olla?

Jaga seda postitust


Postituse link
Share on other sites

Lollid vead olete teinud, nüüd peaks korras olema:

 

#include 
#include 
#include 

#define P_ACCESS	ADMIN_LEVEL_D
#define Q_ACCESS	ADMIN_LEVEL_E
#define R_ACCESS	ADMIN_LEVEL_F
#define S_ACCESS	ADMIN_LEVEL_G

new g_Enable;
new g_bwEnt[33];
new g_CachedStringInfoTarget;

public plugin_init() {
register_plugin("Santa Hat", "1.2", "xPaw");
register_cvar("santa_hat", "1.2", FCVAR_SERVER);
g_Enable = register_cvar("amx_santahat", "1");

RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
g_CachedStringInfoTarget = engfunc( EngFunc_AllocString, "info_target" );
}

public plugin_precache()
precache_model("models/santa_hat.mdl");

public fwHamPlayerSpawnPost(const player) {
if((get_pcvar_num(g_Enable) && is_user_alive(player)) && (get_user_flags(player) & P_ACCESS || get_user_flags(player) & Q_ACCESS  || get_user_flags(player) & R_ACCESS || get_user_flags(player) & S_ACCESS)) {
	new iEnt = g_bwEnt[player];
	if(!pev_valid(iEnt)) {
		g_bwEnt[player] = iEnt = engfunc (EngFunc_CreateNamedEntity, g_CachedStringInfoTarget);
		set_pev(iEnt, pev_movetype, MOVETYPE_FOLLOW);
		set_pev(iEnt, pev_aiment, player);
		engfunc(EngFunc_SetModel, iEnt, "models/santa_hat.mdl");
	}
}
}


Veebiprogrammeerija & kujundaja

Jaga seda postitust


Postituse link
Share on other sites
VIP
Author of the topic Postitas

OK. Kohe panen peale, testin

 

---------- Post added 08-12-11 at 18:15 ----------

 

Hetkel siis nii, et mütsi saab s õigusega inimene, kuid r õigusega inimene ei saa.. :( Mis seal valesti siis?

 

---------- Post added 08-12-11 at 18:26 ----------

 

aaa.. ei, kõik töötab ikkagi. Suur aitäh! :D

Jaga seda postitust


Postituse link
Share on other sites

Kommentaari lisamiseks loo konto või logi sisse

Kommenteerimiseks peate olema liige

Loo konto

Liituge meie kommuuni uue kontoga. See on lihtne!

Loo uus konto

Logi sisse

On juba konto? Logi sisse siit.

Logi sisse nüüd
Jälgi teemat sisse logides  

×
×
  • Loo uus...

Oluline informatsioon

Selle veebisaidi paremaks muutmiseks oleme teie seadmesse paigutanud küpsised . Võite kohandada oma küpsiste seadeid , vastasel juhul eeldame, et te olete küpsiste kasutamisega nõus kui jätkate veebisaidil sirvimist.. Palun lugege läbi Kasutustingimused ja Privaatsuspoliitika.