Raised This Month: $ Target: $400
 0% 

Give experience on roundstart


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 05-10-2014 , 12:25   Give experience on roundstart
Reply With Quote #1

Hello guys,

I've been trying to give experience to players when the round start. I'm trying to do this with a loop, however the server is crashing upon execute. I'm wondering what's wrong with this:

Code:
public RoundStart() {
	for (new i=0; i < 33; i++){
		if(!is_user_bot(i)) {
		RoundExperience(i)
		}
	}
}

public RoundExperience(id) {
	Give_Xp(id, 20)
}

Last edited by egbertjan; 05-10-2014 at 12:27.
egbertjan is offline
connoisseur
Senior Member
Join Date: Jan 2012
Old 05-10-2014 , 12:49   Re: Give experience on roundstart
Reply With Quote #2

Use get_players
connoisseur is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 05-10-2014 , 13:32   Re: Give experience on roundstart
Reply With Quote #3

Thank you
egbertjan is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 05-10-2014 , 13:48   Re: Give experience on roundstart
Reply With Quote #4

Actually I tried to do it with this:

Code:
	new players[32], num
	get_players(players,num,"a")	
	
	for(new i=0 ; i<num ; i++) {
		Give_Xp(i,20)
	}
However this will give 20 XP multiplied by the amount of people on the team.
egbertjan is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 05-10-2014 , 14:21   Re: Give experience on roundstart
Reply With Quote #5

Use player_spawn...

@connoisseur if u dont know shit, shutup.
__________________
Retired.
Xalus is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 05-10-2014 , 14:27   Re: Give experience on roundstart
Reply With Quote #6

You mean by using:
Code:
RegisterHam(Ham_Spawn,"player","playerSpawn");

public playerSpawn(id)
{
    if(NotFirstSpawn[id])
    {
        /* Code for handling spawn here */
    }
    else
    {
        NotFirstSpawn[id] = true;
    }
}
Could this fully replace my Round_start ?

Code:
register_logevent("RoundStart", 2, "0=World triggered", "1=Round_Start")
egbertjan is offline
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 05-10-2014 , 14:49   Re: Give experience on roundstart
Reply With Quote #7

Code:
for (new i=0; i < 33; i++){
		if(!is_user_bot(i)) {
		RoundExperience(i)
		}
	}

------------>

Code:
for (new i=1; i <= get_maxplayers(); i++){
		if(!is_user_bot(i) && is_user_alive(i)) {
		RoundExperience(i)
		}
	}

Last edited by EDUTz; 05-10-2014 at 14:50.
EDUTz is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 05-10-2014 , 14:53   Re: Give experience on roundstart
Reply With Quote #8

@EDUTz
Is this a loop to make it easier on the CPU? If so then this could also explain some of my lag issues and in that case I'm thankful if this may solve it!
egbertjan is offline
connoisseur
Senior Member
Join Date: Jan 2012
Old 05-10-2014 , 14:56   Re: Give experience on roundstart
Reply With Quote #9

@Xalus There can be more than 1 solution to every problem and mine would work too. Yours sucks by the way.
Did he say he wants to hook spawn? If you hook spawn, players can exploit reconnect to gain more points.
Seems like you're the one who doesn't know shit.
Have a nice day.

Last edited by connoisseur; 05-10-2014 at 15:16.
connoisseur is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 05-10-2014 , 15:04   Re: Give experience on roundstart
Reply With Quote #10

Quote:
Originally Posted by egbertjan View Post
Actually I tried to do it with this:

Code:
	new players[32], num
	get_players(players,num,"a")	
	
	for(new i=0 ; i<num ; i++) {
		Give_Xp(i,20)
	}
However this will give 20 XP multiplied by the amount of people on the team.

PHP Code:
Give_Xp(players[i],20
NikKOo31 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode