Promod scripting help
Moderator: Core Staff
Promod scripting help
So I made promodlive server 2.14 and I want a knife round, but it doesn't work... So I made a script, that takes all your weapons and gives you only your knife and empty deagle, but I don't know how to make it so it will execute only in knife round. Is there a command that returns round number or something, e.g. getRound()
Any help will be appreciated
Any help will be appreciated
-
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Re: Promod scripting help
I assume you want the knife only round on the first round each map? If so at the beginning of your knife script use
if( !isDefined(level.kniferound) ) followed by your knife script, and at the end of your knifescript, level.kniferound = true;
This means on the first round it will read the script, level.kniferound won't be defined so it will take players guns etc, and then defines level.kniferound. Every round after it will know that kniferound is defined, and so skip the knife script.
if( !isDefined(level.kniferound) ) followed by your knife script, and at the end of your knifescript, level.kniferound = true;
This means on the first round it will read the script, level.kniferound won't be defined so it will take players guns etc, and then defines level.kniferound. Every round after it will know that kniferound is defined, and so skip the knife script.
-
Re: Promod scripting help
I added strat time and now the knife round does work. The script on the other hand doesn't. But that doesn't matter now, since the knife round works, I don't actually need the script.
Thanks anyway.
Oh and by the way, when I did what you wrote, the script executed in each round, so it was like every round was knife round, then I changed some things and it only executed in the first round, but if you joined in the middle of the game it still executed. I'm not sure why, though
Thanks anyway.
Oh and by the way, when I did what you wrote, the script executed in each round, so it was like every round was knife round, then I changed some things and it only executed in the first round, but if you joined in the middle of the game it still executed. I'm not sure why, though
-
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Re: Promod scripting help
Well glad that you got it sorted, it depends where you were calling the script from really. If it was threaded everytime a player spawns it would be different to everytime a player connects, etc.
-
Re: Promod scripting help
Now I found out there actually is a command, that gives you the round number, or at least number of rounds played
game["roundsplayed"];
so if I'd put if statement with this, it probably would work... too bad I didn't found this earlier, it would have saved me a lot of time
game["roundsplayed"];
so if I'd put if statement with this, it probably would work... too bad I didn't found this earlier, it would have saved me a lot of time
-
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Re: Promod scripting help
Welcome to the world of moddingizak1996 wrote:too bad I didn't found this earlier, it would have saved me a lot of time
-
Re: Promod scripting help
Hello again!
I made a script for k/d ratio but I have a problem, when I had 2 kills and 3 deaths my ratio was 0.6666667... Is there a command or something with which you can set how many places there are after the decimal point? Like there is setprecision in c++?
Any help will be appreciated.
I made a script for k/d ratio but I have a problem, when I had 2 kills and 3 deaths my ratio was 0.6666667... Is there a command or something with which you can set how many places there are after the decimal point? Like there is setprecision in c++?
Any help will be appreciated.
-
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Re: Promod scripting help
Code: Select all
((2/3)*100.00)/100.00
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.
[...]
#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.
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Promod scripting help
Should you not be rounding down after the multiply or does the use of the ".00" change the format?Rezil wrote:Basic idea, depends on how many decimals you want.Code: Select all
((2/3)*100.00)/100.00
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
-
- Core Staff
- Posts: 2030
- Joined: July 24th, 2006, 11:21 am
- Location: Cramped in a small cubicle/making another jump map
Re: Promod scripting help
Haven't tested it but I seem to recall having similar problems in the past. Dividing/multiplying by a less precise number SHOULD set the precision to the number with less decimals, rounded down(because the extra decimal values are 'shaved' off).
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.
[...]
#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.
Re: Promod scripting help
So if I would want to have like this every time (not just with 2 and 3) it would be something like this?
Code: Select all
ratio = ((kills / deaths)*100.00)/100.00;
Re: Promod scripting help
Code: Select all
ratio = 10000.0 * kills / deaths;
ratio = int(ratio);
ratio = ratio/10000.0;
Re: Promod scripting help
I just used this instead:
It works perfectly, with 2 decimal numbers
Thanks anyway
Code: Select all
ratio = int((kills / deaths)*100.00)/100.00;
Thanks anyway
Re: Promod scripting help
Yours is actually the same as mine. I used three lines to make it simple for understanding.
Re: Promod scripting help
And once again I need your help. This is my problem: I created a HUD element, that prints welcome message when you join the server, but the problem is that it prints the message in every round. I tried what F|Madness|U said in his first post, I added if statement:
... didn't work. I tried threading it on player connect as well as on player spawn, none worked. Does anyone know a solution?
Any help will be appreciated
Code: Select all
 if(!isDefined(self.welcome))
{
...
self.welcome = true;
}Â
Any help will be appreciated
Last edited by izak1996 on January 27th, 2013, 12:04 am, edited 1 time in total.
Who is online
Users browsing this forum: Bing [Bot] and 40 guests