Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Опубликовано:

Hi I'm working on my first mod and I want to create a new HUD. So for that I want to disable the actual HUD. mrM9A.png

But without disable the map. How can I do ?

 

Second question I want to create a "Bullet Counter" but I don't know how to display the weapon ammo clip and stock. I try (self.WeaponAmmoClip) and (self.WeaponAmmoStock) but it doesn't work. For health it work ( See the screen above)

 

Thanks in advance and sorry for my english.

Опубликовано:

I'm not sure about the hud, I think there is a dvar ui_hud_hardcore, if that's set to 1, your hud won't be on.

 

also, for your bullets, use the threads like this:

cl = self getWeaponAmmoClip();
st = self getWeaponAmmoStock();

 

That's off the top of my head, sorry if It's wrong. :/

 

I hope that helps, I'm a little tired. :/

Опубликовано:
  • Автор
also, for your bullets, use the threads like this:

cl = self getWeaponAmmoClip();
st = self getWeaponAmmoStock();

 

For the bullet it work ! I just have to add 1 line like this :

	weapon = self getCurrentWeapon();
WAC = self getWeaponAmmoClip( weapon );
WAS = self getWeaponAmmoStock( weapon );

 

And for HUD, both solution remove the map. I want to keep the map

Опубликовано:
  • Автор

And for HUD, both solution remove the map. I want to keep the map

 

ui_hardcore 1
cg_ForceUAV 1

should work and only re-enable your radar an not constantly show the enemies!

 

Do not work :/ HUD is on.

 

_hud.gsc

_hud_util.gsc

look into those, should be able to remove the hud and such...

Hope it helps :D

 

I've already look these gsc but I can't found where they put the icons.

 

Oh and I have another question. My BulletCounter look like this.

bulletcount()
{
self endon("death");
self endon("disconnect");

self.bulletcounter destroy();
self.bulletcounter = self createfontstring( "hudbig",1.2,self );
self.bulletcounter setpoint("","",85,215);
self.bulletcounter.foreground = true;
self.bulletcounter.alpha = 0.6;
self.bulletcounter.glow = 0;
self.bulletcounter.color = ( 1.0, 0.758, 0.191 );

while(1)
{
weapon = self getCurrentWeapon();	
WAC = self getWeaponAmmoClip( weapon );
WAS = self getWeaponAmmoStock( weapon );
self.bulletcounter settext((WAC) + " | " + (WAS));
wait 0.05;
}
}

 

But it crash because I don't destroy the hud (I think) so I got this error "G_FindConfigsstringIndex: overflow (511)

How can I fix this ?

 

EDIT : I've test a new way but same error...

bulletcount()
{
self endon("death");
self endon("disconnect");

while(1)
{
self.bulletcounter = self createfontstring( "hudbig",1.2,self );
self.bulletcounter setpoint("","",85,215);
self.bulletcounter.foreground = true;
self.bulletcounter.alpha = 0.6;
self.bulletcounter.glow = 0;
self.bulletcounter.color = ( 1.0, 0.758, 0.191 );
weapon = self getCurrentWeapon();	
WAC = self getWeaponAmmoClip( weapon );
WAS = self getWeaponAmmoStock( weapon );
self.bulletcounter settext((WAC) + " | " + (WAS));
self waittill_any( "weapon_change","weapon_fired","reload" );
self.bulletcounter destroy();
}
}

Опубликовано:

NOTE: You have to use a waittime (should be >= 0.05) or a waittill in a while(1) / for(;;) -loop otherwise you will get infinite loop errors.

Where do you call bulletcount()?

 

After how many minutes do you get the error?

 

EDIT: Try this:

 

Call the bulletCount() function here (if you do that already, ignore this ;) )

onPlayerSpawned()
{
self endon("disconnect");

for(;
{
	self waittill("spawned_player");
	self thread bulletCount();
}
}

 

bulletCount()
{
self endon("death");
self endon("disconnect");

if( isDefined( self.bulletCounter ) )
self.bulletCounter destroy();
self.bulletCounter = self createfontstring( "hudbig",1.2,self );
self.bulletCounter setpoint("","",85,215);
self.bulletCounter.foreground = true;
self.bulletCounter.alpha = 0.6;
self.bulletCounter.glow = 0;
self.bulletCounter.color = ( 1.0, 0.758, 0.191 );
self thread deleteOnDeath( self.bulletCounter );

for(;
{
	weapon = self getCurrentWeapon();   
	WAC = self getWeaponAmmoClip( weapon );
	WAS = self getWeaponAmmoStock( weapon );
	self.bulletCounter settext((WAC) + " | " + (WAS));
	self waittill_any( "weapon_fired", "weapon_change", "reload" );
}
}


deleteOnDeath( text )
{
self waittill( "death" );
text destroy();
}

Опубликовано:
  • Автор
NOTE: You have to use a waittime (should be >= 0.05) or a waittill in a while(1) / for(;;) -loop otherwise you will get infinite loop errors.

Where do you call bulletcount()?

 

After how many minutes do you get the error?

 

EDIT: Try this:

 

Call the bulletCount() function here (if you do that already, ignore this ;) )

onPlayerSpawned()
{
self endon("disconnect");

for(;
{
	self waittill("spawned_player");
	self thread bulletCount();
}
}

 

bulletCount()
{
self endon("death");
self endon("disconnect");

if( isDefined( self.bulletCounter ) )
self.bulletCounter destroy();
self.bulletCounter = self createfontstring( "hudbig",1.2,self );
self.bulletCounter setpoint("","",85,215);
self.bulletCounter.foreground = true;
self.bulletCounter.alpha = 0.6;
self.bulletCounter.glow = 0;
self.bulletCounter.color = ( 1.0, 0.758, 0.191 );
self thread deleteOnDeath( self.bulletCounter );

for(;
{
	weapon = self getCurrentWeapon();   
	WAC = self getWeaponAmmoClip( weapon );
	WAS = self getWeaponAmmoStock( weapon );
	self.bulletCounter settext((WAC) + " | " + (WAS));
	self waittill_any( "weapon_fired", "weapon_change", "reload" );
}
}


deleteOnDeath( text )
{
self waittill( "death" );
text destroy();
}

 

Same error after 2min :/

Опубликовано:
  • Автор
I guess you have done some other custom settexts then in iyour mod? I have run this counter for 10 minutes

Without a problem...

 

I have, but for the test I've disable them. And I'm sure it's from this counter look the screen.

1345121392-untitled.png

Опубликовано:

Try this. You will have to adjust the label thingy and the x-align value a little bit i guess.

 

 

bulletCount()
{
self endon("death");
self endon("disconnect");

if( !isDefined( self.bulletCounterWAC ) && !isDefined( self.bulletCounterWAS )  )  {
self.bulletCounterWAC = createText("hudbig", 1.2, "", "", 35, 215, 1, 0.6, true, undefined);
self.bulletCounterWAC.color = ( 1.0, 0.758, 0.191 );

self.bulletCounterWAS = createText("hudbig", 1.2, "", "", 85, 215, 1, 0.6, true, undefined);
self.bulletCounterWAS.color = ( 1.0, 0.758, 0.191 );
self.bulletCounterWAS.label = &"| ";

self thread deleteOnDeath();
}

for(;
{
	weapon = self getCurrentWeapon();   
	WAC = self getWeaponAmmoClip( weapon );
	WAS = self getWeaponAmmoStock( weapon );
	self.bulletCounterWAC setValue(WAC);
	self.bulletCounterWAS setValue(WAS);
	self waittill_any( "weapon_fired", "weapon_change", "reload" );
}
}

createText(font, fontScale, align, relative, x, y, sort, alpha, hide, text)
{
textElem = self createFontString(font, fontScale, self);
textElem setPoint(align, relative, x, y);
textElem.sort = sort;
textElem.alpha = alpha;
textElem.hidewheninmenu = hide;
textElem setText(text);
return textElem;
}


deleteOnDeath()
{
self waittill( "death" );
self.bulletCounterWAS destroy();
self.bulletCounterWAC destroy();
}

Опубликовано:
  • Автор
Try this. You will have to adjust the label thingy and the x-align value a little bit i guess.

 

 

bulletCount()
{
self endon("death");
self endon("disconnect");

if( !isDefined( self.bulletCounterWAC ) && !isDefined( self.bulletCounterWAS )  )  {
self.bulletCounterWAC = createText("hudbig", 1.2, "", "", 35, 215, 1, 0.6, true, undefined);
self.bulletCounterWAC.color = ( 1.0, 0.758, 0.191 );

self.bulletCounterWAS = createText("hudbig", 1.2, "", "", 85, 215, 1, 0.6, true, undefined);
self.bulletCounterWAS.color = ( 1.0, 0.758, 0.191 );
self.bulletCounterWAS.label = &"| ";

self thread deleteOnDeath();
}

for(;
{
	weapon = self getCurrentWeapon();   
	WAC = self getWeaponAmmoClip( weapon );
	WAS = self getWeaponAmmoStock( weapon );
	self.bulletCounterWAC setValue(WAC);
	self.bulletCounterWAS setValue(WAS);
	self waittill_any( "weapon_fired", "weapon_change", "reload" );
}
}

createText(font, fontScale, align, relative, x, y, sort, alpha, hide, text)
{
textElem = self createFontString(font, fontScale, self);
textElem setPoint(align, relative, x, y);
textElem.sort = sort;
textElem.alpha = alpha;
textElem.hidewheninmenu = hide;
textElem setText(text);
return textElem;
}


deleteOnDeath()
{
self waittill( "death" );
self.bulletCounterWAS destroy();
self.bulletCounterWAC destroy();
}

 

Seems to work ! Thanks you but can you explain how it works because if I have to create new text I will use this methode.

 

EDIT : Just a problem when I die this remove the counter but not only. It remove all thing in my OnPlayerSpawn

EDIT2 : My bad I do something wrong.

Опубликовано:

Seems to work ! Thanks you but can you explain how it works because if I have to create new text I will use this methode.

 

EDIT : Just a problem when I die this remove the counter but not only. It remove all thing in my OnPlayerSpawn

EDIT2 : My bad I do something wrong.

 

I basically just changed the settext("texthere"); thing which was used in the for(;;)-loop before to setValue(integerValue);. setValue doesn't seem to cause the string overflow errors when you want to display integer values which have to be updated pretty often (in this case the ammo count needs to be updated every time you fire, reload, switch weapon).The disadvantage of setValue is, that you can't just set strings with it. You have to use variableName.label = &"text here"; instead to add strings.

If you just want to display plain text which don't need to be updated, meaning you don't need to use a loop to update it, you can still use settext without any problems.

 

I've also added the !isDefined() check, so that the fontString only gets created if it isn't defined already, but i don't think that it matters in that case...

The other changes were pretty much just cosmetical ones. (Like the new createText() function).

 

Hope that helps. ;)

Опубликовано:
  • Автор

Seems to work ! Thanks you but can you explain how it works because if I have to create new text I will use this methode.

 

EDIT : Just a problem when I die this remove the counter but not only. It remove all thing in my OnPlayerSpawn

EDIT2 : My bad I do something wrong.

 

I basically just changed the settext("texthere"); thing which was used in the for(;;)-loop before to setValue(integerValue);. setValue doesn't seem to cause the string overflow errors when you want to display integer values which have to be updated pretty often (in this case the ammo count needs to be updated every time you fire, reload, switch weapon).The disadvantage of setValue is, that you can't just set strings with it. You have to use variableName.label = &"text here"; instead to add strings.

If you just want to display plain text which don't need to be updated, meaning you don't need to use a loop to update it, you can still use settext without any problems.

 

I've also added the !isDefined() check, so that the fontString only gets created if it isn't defined already, but i don't think that it matters in that case...

The other changes were pretty much just cosmetical ones. (Like the new createText() function).

 

Hope that helps. ;)

 

That help a lot ! :P I will use this topic for my next questions. Thanks again for your help.

Опубликовано:
  • Автор

Sorry for the double post but I don't want to create 50 topic for my questions.

 

Hi again ! I've a new question. Recently i made a thread to drop weapon, it work but when I pick up a weapon on the ground it doesn't work.

dropweap()
{
self endon("death");
self endon("disconnect");
while(1)
{
self notifyOnPlayerCommand("N", "+actionslot 1");
self waittill("N");
CWeapon = self getCurrentWeapon();
if (CWeapon == self.PrimaryWeapon)
	{
	Secondaryname = self.SecondaryWeapon;
	self notifyOnPlayerCommand("N", "+actionslot 1");
	self waittill("N");
	self DropItem( CWeapon );
	self switchToWeapon(Secondaryname);
	}
if (CWeapon == self.SecondaryWeapon)
	{
	Primaryname = self.PrimaryWeapon;
	self notifyOnPlayerCommand("N", "+actionslot 1");
	self waittill("N");
	self DropItem( CWeapon );
	self switchToWeapon(Primaryname);
	}
}
}

 

So I think self.PrimaryWeapon give me the name of the weapon in my custom class and not in the primary slot. (Again sorry for my english)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.