Raised This Month: $ Target: $400
 0% 

new SOMETHING[##]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 06-23-2009 , 21:25   new SOMETHING[##]
Reply With Quote #1

PHP Code:
new szarg1[33], szalpha[8], szarg3[8], bool:mode
    read_argv
(1,szarg1,32)
    
read_argv(2,szalpha,7)
    
read_argv(3,szarg3,7)
    new 
ialpha str_to_num(szalpha)
    if(
equal(szarg3,"on"))
        
mode true
        
        
new pid cmd_target(id,szarg1,2)
        if(
pid 0) {
            
hasinvis[pid] = mode
            
if(mode) {
                        
client_print(pid,print_chat,"-[EVIL]- %s is now cloaked ",name)
                        
set_user_rendering(pid,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,ialpha)
            }
            else {
                       
client_print(pid,print_chat,"-[EVIL]- %s is no longer  ",name)
                       
set_user_rendering(pid,kRenderFxNone,0,0,0,kRenderNormal,ialpha)
            }
        }
    } 
I dont fully understand new (brand new to scripting)

new (creates something) arg (it is called upon in the command?)[] (length?) is this right?
__________________
+|- KARMA Respectively

HLM is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-23-2009 , 21:33   Re: new SOMETHING[##]
Reply With Quote #2

"new" initializes a new variable.
The name you choose is your choice and has nothing to do with the variable except for when you use it.
The name simply lets you access it and it should describe what the variable is for so it isn't confusing.
You can create cells and arrays of cells.

Code:
new variable; // created a variable called "variable" new variable2[10]; // created an array called "variable2" with 10 slots // the slots can be accessed by using 0 to (slots - 1). // Example: this variable's slots will be accessed with 0 to 9. variable[10] = 1; // this will cause an "index out of bounds" error because this is the 11th slot which does not exist.

To learn Pawn, here are some good tutorials:

http://forums.alliedmods.net/showthread.php?t=94381
http://forums.alliedmods.net/showthread.php?t=91207

EDIT: Hi, fysiks. You beat me before I edited ><
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-23-2009 , 21:34   Re: new SOMETHING[##]
Reply With Quote #3

Programming for Starters:
http://forums.alliedmods.net/showthread.php?t=91207
__________________
fysiks is offline
Old 06-23-2009, 21:34
Exolent[jNr]
This message has been deleted by Exolent[jNr]. Reason: Edited above.
Old 06-23-2009, 21:40
HLM
This message has been deleted by HLM. Reason: fysikis answered this (sorta)
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 15:38.


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