Raised This Month: $ Target: $400
 0% 

[SOLVED]%d, s and so on help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-18-2013 , 07:03   [SOLVED]%d, s and so on help
Reply With Quote #1

I would like to know if I am doing it right... I tried %s and %d...
PHP Code:
ItemChoise M4A1
client_print
idprint_center"%L"id"CHOSE_M4A1"ItemChoise ); 
Code:
CHOSE_M4A1 = You succesfully got %d!

Last edited by Unkolix; 02-19-2013 at 06:33.
Unkolix is offline
AngeIII
Senior Member
Join Date: Sep 2007
Location: Latvia
Old 02-18-2013 , 07:18   Re: %d, s and so on help
Reply With Quote #2

the problem can be here:
ItemChoise = M4A1

if ItemChoise are integer-number use %d
if itemchoise are string(chars array) use %s

also what is M4A1 -> ?? variable or string? if you wan't it to string do like this:

new ItemChoise[] = "M4A1";
and use %s

__________________
skype: pavle_ivanof
-=ThQ=-
PRIVATE SUPPORT = PAID SUPPORT
AngeIII is offline
Send a message via Skype™ to AngeIII
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 02-18-2013 , 07:20   Re: %d, s and so on help
Reply With Quote #3

Doesn't this seem more appropriate:

PHP Code:
new szWeapon32 ];
get_weaponnameItemChoiseszWeaponcharsmaxszWeapon ) );
    
client_printidprint_center"%L"LANG_SERVER"WEAPON_CHOOSE"szWeapon ); 
Code:
WEAPON_CHOOSE = You succesfully got %s!
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 02-18-2013 at 07:22. Reason: forgot lang
hornet is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-18-2013 , 07:39   Re: %d, s and so on help
Reply With Quote #4

Quote:
Originally Posted by AngeIII View Post
the problem can be here:
ItemChoise = M4A1

if ItemChoise are integer-number use %d
if itemchoise are string(chars array) use %s

also what is M4A1 -> ?? variable or string? if you wan't it to string do like this:

new ItemChoise[] = "M4A1";
and use %s

You see, I have another menu after that one, and if player chose M4A1, next he must choose from primary guns and when he does so, he should get a message like this
Code:
CHOSE_DEAGLE = You succesfully got %s with Deagle!
BTW, your code seems to be bad because I get that
Code:
Invalid subscript(not an array or too many subscripts)
Maybe more code would help you understand?
PHP Code:
case 1
{              
    
StripWeapons(idPrimary);
    
give_item(id,"weapon_m4a1"//Gives VIP M4A1
    
cs_set_user_bpammo(idCSW_M4A190); //Sets VIP M4A1 back pack ammo to 90
    
ItemChoise[] = "M4A1"
    
client_printidprint_center"%L"id"CHOSE_M4A1"ItemChoise );
    
gbMenuUsed[id] = true//Makes sure that VIP really made a choise
}
/***/
case 1
{                      
    
StripWeapons(idSecondary);
    
give_item(id,"weapon_deagle"//Gives VIP Deagle
    
cs_set_user_bpammo(idCSW_DEAGLE35); //Sets VIP Deagle back pack ammo to 35
    
client_printidprint_center"%L"id"CHOSE_DEAGLE"ItemChoise );

Code:
CHOSE_M4A1 = You succesfully got %d!
CHOSE_DEAGLE = You succesfully got %s with Deagle!

Last edited by Unkolix; 02-18-2013 at 07:44.
Unkolix is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 02-18-2013 , 08:29   Re: %d, s and so on help
Reply With Quote #5

Use my concept, but create an array for weapon names ... dunno what made me come to using get_weaponname() lol ...
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-18-2013 , 09:17   Re: %d, s and so on help
Reply With Quote #6

Can you create that array? I don't quite understand you :/
Unkolix is offline
EDUTz
Senior Member
Join Date: Jun 2010
Location: Dracula's Homeland
Old 02-18-2013 , 20:41   Re: %d, s and so on help
Reply With Quote #7

Code:
new const PRIMARY_NAMES[][] =
{
	"M4A1",
	"AK47",
	"MP5NAVY",
        "G3SG1",
	"AWP"

}
Code:
public mostrar_cliente(id, menu, item)
{
	new data[6], iName[64]
	new access, callback
	menu_item_getinfo(menu, item, access, data,7, iName, 63, callback)
	new key = str_to_num(data)
	client_print(id, print_chat, "%L ^"%s^"", id, "CHOOSE_WEAPON", PRIMARY_NAMES[key])
ML language: CHOOSE_WEAPON = You have chosen
EDUTz is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-19-2013 , 04:29   Re: %d, s and so on help
Reply With Quote #8

Shouldn't I add this code
PHP Code:
client_print(idprint_chat"%L ^"%s^""id"CHOOSE_WEAPON"PRIMARY_NAMES[key]) 
in switch cases?

And maybe this? ML language: CHOOSE_WEAPON = You have chosen %d!

Last edited by Unkolix; 02-19-2013 at 04:30.
Unkolix is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 02-19-2013 , 06:30   Re: %d, s and so on help
Reply With Quote #9

Quote:
Originally Posted by Unkolix View Post
And maybe this? ML language: CHOOSE_WEAPON = You have chosen %d!
No, %d and %i are for integers, not strings.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-19-2013 , 06:33   Re: %d, s and so on help
Reply With Quote #10

Ok, thanks.
Unkolix 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 21:36.


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