Raised This Month: $ Target: $400
 0% 

[ Solved ] Define created


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-28-2012 , 03:23   [ Solved ] Define created
Reply With Quote #1

Hello, i've a little problem with my define wich i was created.

Code:
#define give_weapons( %1 , %2 , %3 , %4 )   give_item( %1 , %2 )                                             cs_set_user_bpammo( %1 , %3 , %4 )

For doing this after in my code :

Code:
give_weapons( id , "weapon_m4a1" , CSW_M4A1 , 250 );

But it do not work. Why ?
Is it possible or not ?
__________________
Pawn ? Useless

Last edited by Aooka; 06-28-2012 at 03:26.
Aooka is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 06-28-2012 , 06:28   Re: [ Request ] Define created
Reply With Quote #2

PHP Code:
stock give_weaponsplayer weaponname[] , weaponID bullets )
{     
     
give_itemplayer weaponname )
     
cs_set_user_bpammoplayer weaponID bullets )

__________________
Retired.

Last edited by Xalus; 06-28-2012 at 06:29.
Xalus is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-28-2012 , 06:31   Re: [ Request ] Define created
Reply With Quote #3

Oh thanks. So it's impossible to do that with ... define ?
It's work fine
__________________
Pawn ? Useless
Aooka is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 06-28-2012 , 06:33   Re: [ Request ] Define created
Reply With Quote #4

You can't do that are you want to do in a simple 'define'.

You should create a stock or something ( i think ).
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-28-2012 , 06:34   Re: [ Request ] Define created
Reply With Quote #5

You can use a macro, but it should more defined like that :

Code:
#define give_weapons(%1,%2,%3,%4)   ( give_item( %1, %2 ), cs_set_user_bpammo( %1, %3, %4 ) )
Note you must not put space in the header.
__________________
Arkshine is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-28-2012 , 06:43   Re: [ Request ] Define created
Reply With Quote #6

Okay Thanks Lucas and Arkshine.
So one more question before to close the thread.

What is the best the define or the stock ?

Edit: I do that :
Code:
#define last_strip(1%,2%)       ( strip_user_weapons( %1 ), strip_user_weapons( %2 ), give_item( %1 "weapon_knife" ), give_item( %2 "weapon_knife" ) )

But it's too long. Is it possible to make a define on different line ?
__________________
Pawn ? Useless

Last edited by Aooka; 06-28-2012 at 06:49.
Aooka is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-28-2012 , 07:12   Re: [ Request ] Define created
Reply With Quote #7

Situational.
Backstabnoob is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-28-2012 , 07:25   Re: [ Request ] Define created
Reply With Quote #8

You have to use '\' to put things on another line.
That's said, you don't have to define things for all. For a group of natives, more appropriate to use a function instead, because if such macro is used more than one time, it's going to be redundant and you will increase plugin size for nothing. Also, for readability/debug/practical reason, there is no point to use a macro here.
__________________
Arkshine is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-28-2012 , 08:13   Re: [ Request ] Define created
Reply With Quote #9

Ok thanks a lot.

Solved
__________________
Pawn ? Useless
Aooka is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 06-28-2012 , 10:57   Re: [ Solved ] Define created
Reply With Quote #10

Just to say it do not work when i do with '\'. It's work only if i compil in local. Impossible to compile on-line.
__________________
Pawn ? Useless

Last edited by Aooka; 06-28-2012 at 10:57.
Aooka 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 06:11.


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