Raised This Month: $51 Target: $400
 12% 

C4 Taker


Post New Thread Reply   
 
Thread Tools Display Modes
hellmonja
Senior Member
Join Date: Oct 2015
Old 06-25-2016 , 13:25   Re: C4 Taker
Reply With Quote #31

Quote:
Originally Posted by HamletEagle View Post
Everything looks ok.
Approved.
YES! Thank you so much! I'll try to do better and remember everything next time. Now I feel like celebrating by getting some sleep...
__________________
hellmonja is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-25-2016 , 13:45   Re: C4 Taker
Reply With Quote #32

Code:
do
{
	i = random_num(0, pnum - 1);
}
while(!is_user_admin(players[i]));
I smell infinite loop. You should test your plugin more seriously.
__________________

Last edited by Arkshine; 06-25-2016 at 13:45.
Arkshine is offline
KleinMarquez
Senior Member
Join Date: Jun 2016
Location: Calapan City, Philippine
Old 06-26-2016 , 00:18   Re: C4 Taker
Reply With Quote #33

Quote:
Originally Posted by Arkshine View Post
Code:
do
{
	i = random_num(0, pnum - 1);
}
while(!is_user_admin(players[i]));
I smell infinite loop. You should test your plugin more seriously.
What is infinite loop?
KleinMarquez is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 06-26-2016 , 01:55   Re: C4 Taker
Reply With Quote #34

Quote:
Originally Posted by KleinMarquez View Post
What is infinite loop?
A loop that does not end. If the admin is not a Terrorist, the function could go on and on. We are trying to find someway to efficiently determine who the admin is and not be stuck on an infinite loop.

Perhaps the old way? get_players()?...
__________________

Last edited by hellmonja; 06-26-2016 at 01:58. Reason: typo...
hellmonja is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-26-2016 , 04:03   Re: C4 Taker
Reply With Quote #35

There is several ways. You can for example loop over all terrorists and saving in an array all the admin indexes (saving count too), then at the end, randomly retrieving an index from that array.
__________________
Arkshine is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 06-26-2016 , 17:48   Re: C4 Taker
Reply With Quote #36

for(new i; i < pnum; i++){
tmp = players[i]
if(is_user_admin(tmp)
{
do
{
i = random_num(0, pnum - 1);
tmp=players[i]
}
while(!is_user_admin(tmp));
//yourvstuff

return;
}
}
siriusmd99 is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 06-27-2016 , 19:49   Re: C4 Taker
Reply With Quote #37

UPDATE v1.09
  • Removed a potential infinite loop
__________________
hellmonja is offline
Rondanjanlonran
Junior Member
Join Date: Mar 2016
Location: Dog House
Old 07-02-2016 , 02:26   Re: C4 Taker
Reply With Quote #38

Awsome , taking c4 for your teammate ? that very awsome !
__________________
(❍ᴥ❍ʋ)
Rondanjanlonran is offline
hellmonja
Senior Member
Join Date: Oct 2015
Old 07-04-2016 , 12:16   Re: C4 Taker
Reply With Quote #39

Quote:
Originally Posted by Rondanjanlonran View Post
Awsome , taking c4 for your teammate ? that very awsome !
Thanks man. Glad you liked it...
__________________
hellmonja is offline
KleinMarquez
Senior Member
Join Date: Jun 2016
Location: Calapan City, Philippine
Old 08-02-2016 , 04:53   Re: C4 Taker
Reply With Quote #40

public client_disconnect(id)
num[id] = 0; //Resets 'num' to 0 when a player disconnects

Take a look the code.
KleinMarquez 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 16:36.


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