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

return string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 08-22-2013 , 18:56   return string
Reply With Quote #1

hallo, i have search about return string in this forum,
and most the people said sourcemod cannot do this.
so i have try..
PHP Code:
new String:mystring[64]

public 
getstring(CaseNum)
{
    switch(
CaseNum)
    {
        case 
1FormatEx(mystring,63,"case1")
        case 
2FormatEx(mystring,63,"case2")
        
//...etc
    
}

is this a good way to script like this?

sorry for my poor english
__________________
My Plugins

C4man with fun

Sniper Skill bonus
-------------------------
Sorry for my poor English!

Last edited by biscuit628; 08-22-2013 at 18:57.
biscuit628 is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-22-2013 , 19:03   Re: return string
Reply With Quote #2

A search of "return string" brings up a clear example - http://forums.alliedmods.net/showthread.php?t=92878
__________________
thetwistedpanda is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 08-22-2013 , 19:34   Re: return string
Reply With Quote #3

PHP Code:
public getstring(CaseNumString:str[], len
This should be intuitive. You use FormatEx in your code - what does this native do? You give it a string and the string's length, and it "returns" output based on implementation. By the same reasoning, surely you can work out that you needed to do the same, that is, change your function to accept a string, and the string's length.

PHP Code:
new String:mystring[64]

public 
getstring(CaseNumString:str[], len)
{
    switch(
CaseNum)
    {
        case 
1FormatEx(str,len,"case1")
        case 
2FormatEx(str,len,"case2")
        
//...etc
    
}
}

//Usage: getstring(number, mystring, sizeof(mystring)) 
__________________

Last edited by 11530; 08-22-2013 at 19:50.
11530 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 23:09.


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