Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!
Moderator: Core Staff
-
Rezil
- Core Staff

- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Post
by Rezil » June 12th, 2011, 12:23 am
I'm pretty sure setText() takes a localized string as a parameter, try putting a & in front, something along the lines of
Also, does self.getxuid actually hold a value?
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
-
F |Madness| U
- CJ G0D!

- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 12th, 2011, 12:35 am
Rezil wrote:I'm pretty sure setText() takes a localized string as a parameter, try putting a & in front, something along the lines of
Also, does self.getxuid actually hold a value?
I tryed that and got error "pair `` and `undefined` are not `localised string` and `undefined`" or something.
And I'm not sure if self.getxuid holds a value, I'm a noob scripter, but getxuid is a valid function, so would self.getxuid get the players xuid? (xuid is similar to a guid afaik but without pb).
-
-
Rezil
- Core Staff

- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Post
by Rezil » June 12th, 2011, 12:51 am
Code: Select all
xuid = self getXUID();
xuidTest setText(&xuid);
I hope you can localize variables, otherwise you're going to have to make a localized string file or set your HUD text some other way.
Another question, does your code otherwise work? I mean the text on screen part, self.getxuid doesn't do anything since it's not a valid entity variable.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
-
F |Madness| U
- CJ G0D!

- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 12th, 2011, 10:35 am
Yeah the rest of the code on screen works, I've been searching and trying many other things (a post on another forum said that):
in OnPlayersConnect() would work, but it comes up with "struct is not an entity" error. Really stuck on this at the moment!
-
-
Drofder2004
- Core Staff

- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » June 12th, 2011, 10:51 am
F |Madness| U wrote:Yeah the rest of the code on screen works, I've been searching and trying many other things (a post on another forum said that):
in OnPlayersConnect() would work, but it comes up with "struct is not an entity" error. Really stuck on this at the moment!
self.guid is (at least in CoD4) not a valid value.
If you do "
self.guid = self getGUID();" then you will be able to do "
iprintlnbold(self.guid);"
Or simply "
iprintlnbold(self getGuid());"
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
IzNoGoD
- CJ Worshipper

- Posts: 343
- Joined: January 6th, 2009, 8:39 pm
- Location: Netherlands/Holland
Post
by IzNoGoD » June 12th, 2011, 11:29 am
F |Madness| U wrote:Yeah the rest of the code on screen works, I've been searching and trying many other things (a post on another forum said that):
in OnPlayersConnect() would work, but it comes up with "struct is not an entity" error. Really stuck on this at the moment!
Struct is not an entity implies that self is not defined there - please correct me if im wrong, as im not familiar with any code other than cod2's, and this thread doesnt exist there.
LMGTFY!
Its not a glitch... Its the future!
-
F |Madness| U
- CJ G0D!

- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 12th, 2011, 12:40 pm
Argh this is weird. I tested iprintlnbold(getDvar("g_gametype")); and it worked, printed the gametype on the screen.
I then tested a variety of different ways, including iprintlnbold(getMapName());, iprintlnbold(getClientName());, iprintlnbold(getWeaponName());. (All of these are listed as functions on Black Ops), and for all of those I received unknown function error.
And if I tryed iprintlnbold(self getxuid());, I didn't get unknown function, but struct is not an entity error. Would anyone be able to try and explain some of this to me? :S
-
-
IzNoGoD
- CJ Worshipper

- Posts: 343
- Joined: January 6th, 2009, 8:39 pm
- Location: Netherlands/Holland
Post
by IzNoGoD » June 12th, 2011, 12:47 pm
IzNoGoD wrote:
Struct is not an entity implies that self is not defined there - please correct me if im wrong, as im not familiar with any code other than cod2's, and this thread doesnt exist there.
Define self
Also, stop calling stuff on nothing, like getclientid();. Use self getclientid() instead, AFTER you defined self
http://modsonline.com/Forums-top-134675.html <--tutorial you should read
LMGTFY!
Its not a glitch... Its the future!
-
F |Madness| U
- CJ G0D!

- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 12th, 2011, 1:55 pm
Thankyou very much for that tutorial, I understand self/player/level much more than I did before now!
-
-
F |Madness| U
- CJ G0D!

- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 12th, 2011, 7:57 pm
If somebody could explain this code to me it would be great, basically when you press melee button music plays, and when you press it again it stops. Code is
Code: Select all
for(;;)
{
while(!self MeleeButtonPressed())
wait 0.05;
clientnotify("notify_stones");
iPrintLnBold("^1Music On");
wait 0.2;
while(!self MeleeButtonPressed())
wait 0.05;
clientnotify("none");
iPrintLnBold("^1Music Off");
wait 0.2;
}
Now doesn't this mean the argument is (not pressing melee button), so when the argument is true, it infinitely loops. Therefore shouldn't the music be constantly stopping/starting when you're not pressing melee? I've definitely got the wrong concept or something, if somebody could explain it in `simpleton` terms it would be awesome.
-
-
Rezil
- Core Staff

- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Post
by Rezil » June 12th, 2011, 8:09 pm
It's sloppy coding, and it's putting a considerable ammount of stress on the server. Basically it's an infinite loop, inside it checks if the melee button is not pressed(so if self MeleeButtonPressed() returns false). If it is false, it constantly waits for 0.05 seconds until you press the melee button, then it notifies the player and prints text on the screen. After that it loops again for the same thing, just notifying something else.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.
-
F |Madness| U
- CJ G0D!

- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 12th, 2011, 8:18 pm
Okay thanks Rezil, I think I understand it now. Just wondering you said it would put a considerable amount of stress on the server, so if there was lots of code that did this, would it basically make the server lag alot? And how might that code be edited to put less stress on, because as a beginner I don't really know what will put stress onto a server or not. (This wasn't my code by the way). -Thanks.
-
-
Drofder2004
- Core Staff

- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » June 12th, 2011, 8:23 pm
Code: Select all
for(;;)
{
/* While the button is not being pressed, infinitly wait */
while(!self MeleeButtonPressed())
wait 0.05;
/* Send a notify to client [turns on music]*/
clientnotify("notify_stones");
/* Show message on screen, then wait*/
iPrintLnBold("^1Music On");
wait 0.2;
/* While the button is not pressed, continue to wait again */
while(!self MeleeButtonPressed())
wait 0.05;
/* Send a notify to client [turn off music] */
clientnotify("none");
/* Show message and wait */
iPrintLnBold("^1Music Off");
wait 0.2;
}
Basically, the code is waiting UNTIL you press the melee button.
Pseudocode:
While the player is NOT pressing the button, wait until he presses the button.
Understand?
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
-
F |Madness| U
- CJ G0D!

- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » June 12th, 2011, 8:44 pm
I understand it now thanks Drofder

I think it was the layout of the code that put me off
Code: Select all
3.
while(!self MeleeButtonPressed())
Â
4.
wait 0.05;
Â
5.
clientnotify("notify_stones");
Â
6.
iPrintLnBold("^1Music On");
Â
7.
wait 0.2;
Â
Made me think that whilst the melee button was not pressed, it would wait 0.05, then notify, then print, then wait 0.2, and repeat. I didn't realise the wait 0.05; was `linked` to the while argument.
One thing I've been wanting to know for a while is about creating new gametypes spefically for mods. Eg. codjumper mod used to run on "dm" but you then made it's own gametype "cj". What advantages are there of doing this and how might it be done? I notice that most mods have their own gametype.
-
-
Drofder2004
- Core Staff

- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » June 12th, 2011, 9:04 pm
The CJ Mod is just a renamed "DM".
Most of the benefits are aesthetics, having the "cj" gametype in a rotation, when you search servers you will see "cj" when loading the mod you will see the CJ mod title...
Other small (CoD4 at least) benefits are automatically created dvars, such as timelimits and scorelimits. These are not a major requirement for CJ as they already existed.
You latch your mod on to an existing gametype, ased on the gametype attributes.
DM - Free-For-All. No team based stuff.
TDM - Team based. No objectives.
SD - Team based. Objectives. Round based.
CTF - Team Based. Objectives. Not round based.
HQ - Team based. Objectives. Not round based. Dead-stay-dead.
I do not know a gametype off the top of my head, that does not have a base of one of the above.
E.g Zombies is probably TDM.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Users browsing this forum: No registered users and 1 guest