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

Player index question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CHE4TER
Member
Join Date: Jul 2013
Location: Portugal
Old 06-03-2014 , 17:22   Player index question
Reply With Quote #1

When getting user auth id/name/etc, I need a index of [33] or higher?

PHP Code:
new steam[33]
get_user_authid(id,steam32)

new 
player[33
get_user_name(idplayer32
Does it matter? Or at different functions I will need to use more then that [33]?
CHE4TER is offline
!Morte
Veteran Member
Join Date: May 2010
Old 06-03-2014 , 18:33   Re: Player index question
Reply With Quote #2

To index an array for a player, you must use the [33], for every else you can use the number you want.

There you're trying to get the name/user id for a player, you must create an array in which you will keep the name, the number you put on that array is the length of the player name, in this case use 32 or less, because the engine has a limit of the name length. (It's not necessary to put a biggest number if you won't use all the array slots)

PHP Code:
new name32 ]
get_user_nameidname31 
Whatever, i suggest to you to take a look to this post: https://forums.alliedmods.net/showthread.php?t=172936 because my explanation it's a shit
__________________
First Zombie Class
[ZP] Zombie Class: Houndeye Zombie
Quote:
Originally Posted by lucas_7_94 View Post
tenes que saber pawn antes de intentar hacer algo digno.

Last edited by !Morte; 06-03-2014 at 18:34.
!Morte is offline
Send a message via MSN to !Morte Send a message via Skype™ to !Morte
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-03-2014 , 18:40   Re: Player index question
Reply With Quote #3

Also is good to avoid hardcoding and use charsmax() or sizeof() - 1, isntead of just puttign 31 in the native. Not a big deal, but if you change some array size somewhere, the hardcoding may f*ck up everything.
PHP Code:
get_user_nameidname31 
-->
PHP Code:
get_user_nameidnamecharsmax(name) ) 
__________________

Last edited by Flick3rR; 06-03-2014 at 18:41.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 06-04-2014 , 18:05   Re: Player index question
Reply With Quote #4

more clear information about array and string size are available here.
https://forums.alliedmods.net/showth...t=94381#arrays
Fr33m@n 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 00:19.


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