AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   operator (https://forums.alliedmods.net/showthread.php?t=93992)

Atspulgs 06-05-2009 08:47

operator
 
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")

toazron1 06-05-2009 08:58

Re: operator
 
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(...)

[X]-RayCat 06-05-2009 09:11

Re: operator
 
http://forums.alliedmods.net/showthread.php?t=91207
http://wiki.amxmodx.org/Pawn_Tutorial

Dr.G 06-05-2009 09:12

Re: operator
 
http://www.w3schools.com/PHP/php_operators.asp

Atspulgs 06-05-2009 09:18

Re: operator
 
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?

fysiks 06-05-2009 18:24

Re: operator
 
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.


All times are GMT -4. The time now is 23:36.

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