Raised This Month: $ Target: $400
 0% 

Help for a useful plugin?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-06-2010 , 16:52   Re: Help for a useful plugin?
Reply With Quote #5

Quote:
Originally Posted by drekes View Post
about the for loops. It's actually quite simple.

PHP Code:
new players[32]; // To hold the players id.
new pnum// The amount of players.
new tempid// To store the temporary player ids

get_players(playerspnum); // Counts the players

for(0pnumi++) 
{    
    
// i < pnum means as long as i smaller then the amount of players, it continues to loop
    
tempid players[i// store the temporary id in a var

    
if(!is_user_alive(tempid))// If he is dead, skip him
        
continue;

    
set_user_health(tempid100); // Just an example

The variable named "i" is never created. Also your way of using continue is horrible. I believe flagging alive players doesn't give you that much false positives.
.
PHP Code:
for( new playerplayer pnumplayer++ )
     if( 
is_user_alive( ( tempid playersplayer ] ) ) )
          
set_user_healthtempid100 ); 
SnoW is offline
Send a message via MSN to SnoW
 



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 07:06.


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