Raised This Month: $ Target: $400
 0% 

[HELP] strings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thegeneral1999
AlliedModders Donor
Join Date: Apr 2013
Location: Portugal
Old 12-06-2015 , 14:55   [HELP] strings
Reply With Quote #1

I'm trying to define a variable with more than one string but do not know how to do it.

new var1 = 2;
new var2 = 3;
new var3 = 4;

new iData [2];
iData [0] = iPlayer;
iData [1] = (I want that) 234
__________________
thegeneral1999 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-06-2015 , 15:28   Re: [HELP] strings
Reply With Quote #2

?
PHP Code:
enum PlayerData
{
    
PlayerID,
    
PlayerString10 ]
}
new 
pdDataPlayerData ];

new 
iPlayer 10;

new 
var1 2;
new 
var2 3;
new 
var3 4;

pdDataPlayerID ] = iPlayer;
formatexpdDataPlayerString ] , charsmaxpdDataPlayerString ] ) , "%d%d%d" var1 var2 var3 ); 
__________________

Last edited by Bugsy; 12-06-2015 at 15:31.
Bugsy is offline
thegeneral1999
AlliedModders Donor
Join Date: Apr 2013
Location: Portugal
Old 12-06-2015 , 15:45   Re: [HELP] strings
Reply With Quote #3

I made the formatex and stayed that way because the charmax() was giving an error

formatex( g_iPlayerData[ id ][ DATA_STRING ], 32, "%d%d%d", var1, var2, var3);

This correct?
__________________
thegeneral1999 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-06-2015 , 16:08   Re: [HELP] strings
Reply With Quote #4

Why would you take out charsmax()? I put it there for a reason.

I need more info about what you need. Don't speak in code, speak in English about what you want to do.
PHP Code:
#define MAX_PLAYERS 32

enum PlayerData
{
    
PlayerID,
    
PlayerString10 ]
}
new 
pdDataMAX_PLAYERS ][ PlayerData ];

new 
iPlayer 10;
new 
id 10;

new 
var1 2;
new 
var2 3;
new 
var3 4;

pdDataid ][ PlayerID ] = iPlayer//This isn't really needed since id=iPlayer
formatexpdDataid ][ PlayerString ] , charsmaxpdData[][ PlayerString ] ) , "%d%d%d" var1 var2 var3 ); 
Based on your original post "define a variable with more than one string" would be something like this: Each player has 5 strings, with a max length of 14 characters.
PHP Code:
new szStringsMAX_PLAYERS ][ ][ 15 ];
    
new 
var1 2;
new 
var2 3;
new 
var3 4;
    
new 
id 10;

formatexszStringsid ][ ] , charsmaxszStrings[][] ) , "String1 val=%d" var1 );  
formatexszStringsid ][ ] , charsmaxszStrings[][] ) , "String2 val=%d" var2 );  
formatexszStringsid ][ ] , charsmaxszStrings[][] ) , "String3 val=%d" var3 ); 
__________________

Last edited by Bugsy; 12-06-2015 at 16:21.
Bugsy is offline
thegeneral1999
AlliedModders Donor
Join Date: Apr 2013
Location: Portugal
Old 12-06-2015 , 16:41   Re: [HELP] strings
Reply With Quote #5

I've managed to solve my problem thanks to you, thanks.

Thanks for your help! You are awesome
__________________
thegeneral1999 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 17:54.


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