Raised This Month: $ Target: $400
 0% 

about id = str_to_num


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-04-2010 , 18:00   Re: about id = str_to_num
Reply With Quote #1

Quote:
Originally Posted by epic . View Post
Code:
public plugin_init()
{
    register_srvcmd("bot","bot_interface")
}
 
public bot_interface()
{
    new sid[8],id
    read_argv(1,sid,7)
    id = str_to_num(sid)
    A_function(id)
 
    return PLUGIN_CONTINUE
}
What does the "id" means here ?
Quote:
Originally Posted by wrecked_ View Post
It's a player index. For example, if sid was equal to "27", id would be 27. It converts the string to a number and stores the numerical value in id.
You are assuming the first argument is a player id because he used the variable name "id". But, infact, it will be what ever string is passed as the first argument of the server command that which is then converted to a integer. So, if you type in

Code:
bot 12325434
id will be 12325434 which definitely is not a player id.
__________________
fysiks 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 03:40.


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