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

Solved How to convert "const String:var[]" to new syntax


Post New Thread Reply   
 
Thread Tools Display Modes
Mitchell
~lick~
Join Date: Mar 2010
Old 10-03-2017 , 18:11   Re: How to convert "const String:var[]" to new syntax
Reply With Quote #11

Seems dumb, Client_HasWeapon works with a client index, why are you converting what ever variable from what it's defined as to int?
Mitchell is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 10-03-2017 , 18:15   Re: How to convert "const String:var[]" to new syntax
Reply With Quote #12

Quote:
Originally Posted by Mitchell View Post
Hmm however it does return a boolean. Could old syntax do that without the right return type?
https://github.com/bcserv/smlib/blob...ents.inc#L1358
I believe the SP compiler doesn't infer types from return statements. So that function does in fact return an int. That function should've been tagged with bool:.

Quote:
Originally Posted by Mitchell View Post
Seems dumb, Client_HasWeapon works with a client index, why are you converting what ever variable from what it's defined as to int?
I'd guess that he has a methodmap that wraps a client/player, so his this is not an int, but its value is a valid client index. But just guessing here.

Last edited by klippy; 10-03-2017 at 18:19.
klippy is offline
popey456963
Member
Join Date: Mar 2016
Old 10-04-2017 , 12:10   Re: How to convert "const String:var[]" to new syntax
Reply With Quote #13

Quote:
Originally Posted by KliPPy View Post
I'd guess that he has a methodmap that wraps a client/player, so his this is not an int, but its value is a valid client index. But just guessing here.
Yep! Otherwise, it complains that it's of type "Player", so I have to specify that it is an int. And I changed the stock to return a bool and everything worked, so thanks for the help guys.
popey456963 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 10-05-2017 , 08:56   Re: How to convert "const String:var[]" to new syntax
Reply With Quote #14

I've fixed the return tag in the repo. You're very welcome to create a pull request next time you find a bug!
__________________
Peace-Maker is offline
popey456963
Member
Join Date: Mar 2016
Old 10-05-2017 , 20:52   Re: How to convert "const String:var[]" to new syntax
Reply With Quote #15

Ah, nice @Peace-Maker! I must admit I didn't as I thought pull requests didn't seem to be being reviewed at the moment (e.g. 39, 45).
popey456963 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 10-06-2017 , 05:24   Re: How to convert "const String:var[]" to new syntax
Reply With Quote #16

Those two add something game specific in two different ways and it wasn't decided how to handle game stocks yet.
__________________
Peace-Maker 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 11:38.


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