Raised This Month: $ Target: $400
 0% 

What means that error?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 01-05-2011 , 05:04   Re: What means that error?
Reply With Quote #7

Quote:
Originally Posted by GXLZPGX View Post
Yes. The first one is calling the function "First_Infected" without a given index, and without an index, I'm gonna take a shot in the dark and say it choses 0 as the index, and 0 isn't a valid player index. The second one though, provides an index.
I'd like to add that id can be 0 too, that depends on how you use it.

PHP Code:
new id;
set_task(1.0"First_Infected"id); 
This will call your function, but id passed in the params will be 0.

PHP Code:
public client_putinserver(id)
    
set_task(1.0"First_Infected"id); 
This will call the function with id being the id of the player that entered the server.

To check if a variable contains a player id, you can use this:
PHP Code:
// Global
#define IsPlayer(%1)    (1 <= %1 <= g_iMaxPlayers)
new g_iMaxPlayers;

public 
plugin_init()
    
g_iMaxPlayers get_maxplayers();

SomeFunc(id)
{
    if(
IsPlayer(id))
        
// It is a  player id, you might wanna check if he's alive and stuff depending on what you are doing here.

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.

Last edited by drekes; 01-05-2011 at 07:26.
drekes is offline
Send a message via MSN to drekes
 



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 01:58.


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