Raised This Month: $32 Target: $400
 8% 

Solved How to choose a random character from a dynamic string?


Post New Thread Reply   
 
Thread Tools Display Modes
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 05-10-2018 , 09:43   Re: How to choose a random character from a dynamic string?
Reply With Quote #11

Quote:
Originally Posted by Fyren View Post
This needs to be strlen(convar_string) - 1.



No. Edit: To be clear, switching on a char is fine.
so thats one benefit of new syntax over old syntax?
__________________
8guawong is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 05-10-2018 , 10:33   Re: How to choose a random character from a dynamic string?
Reply With Quote #12

Quote:
Originally Posted by 8guawong View Post
so thats one benefit of new syntax over old syntax?
You can pick an individual character out of a string (e.g. switch (str[0]) {}) or use a variable that most people wouldn't call "a string" (e.g. new String:s = 'a'; switch (s) {}) with old syntax.
Fyren is offline
Reply


Thread Tools
Display Modes

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 20:40.


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