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

operator


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-05-2009 , 08:47   operator
Reply With Quote #1

what this(+=) operator combo do?

i saw this in Hawk552 gamestatus2.
heres some code:
Quote:
Pos += format(g_HudMessage,sizeof g_HudMessage - 1,"Game Status^n")
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
toazron1
Senior Member
Join Date: Oct 2006
Old 06-05-2009 , 08:58   Re: operator
Reply With Quote #2

count++

its the same as doing

count = count + 1

in this case it adds the string to pos with out having to reassign it

another way would have been
pos = pos + format(...)
__________________
toazron1 is offline
Send a message via AIM to toazron1
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 06-05-2009 , 09:11   Re: operator
Reply With Quote #3

http://forums.alliedmods.net/showthread.php?t=91207
http://wiki.amxmodx.org/Pawn_Tutorial
__________________
[X]-RayCat is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 06-05-2009 , 09:12   Re: operator
Reply With Quote #4

http://www.w3schools.com/PHP/php_operators.asp
__________________
Dr.G is offline
Atspulgs
Senior Member
Join Date: Mar 2008
Old 06-05-2009 , 09:18   Re: operator
Reply With Quote #5

ok help me understand this now.

so i have variable Pos
Quote:
new Pos
ok then i format a string with this
Quote:
format ( output[], len, const format[], ... )
im passing in a array g_HudMessage then i dont know whats sizeof
is it function inbuilt in pawn like equali?
anyways it looks like im taking away from the message(that follows later) 1 and then Pos what is 0 as it was just declared and then is the message itself.

so output of this format will be some integer that will be added on to Pos

right?
__________________
-=DG Ats
DoomedGang web page -
http://www.doomedgang.com
Atspulgs is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-05-2009 , 18:24   Re: operator
Reply With Quote #6

PHP Code:
new g_HudMessage[32]

new 
Pos format(g_HudMessage31"Hello %s""World")
// Or
new Pos format(g_HudMessagesizeof(g_HudMessage) - 1"Hello %s""World"
"Pos" is an integer. And, format() outputs the number of characters that were copied to the string "g_HudMessage". So in this case "Pos" is 11.
__________________

Last edited by fysiks; 06-05-2009 at 18:26.
fysiks 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 07:26.


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