AlliedModders

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

LeaF-666 12-22-2009 13:56

Changing Global
 
Hello there!
I am new here.
I want to know gow to change a global in a public?
Something like:
PHP Code:

new g_noclip 0

public something(id){
//here i want to change g_noclip to 1
//so and so



platzpatrone 12-22-2009 14:09

Re: Changing Global
 
then just do it

PHP Code:

new g_noclip 

public something(id){ 
//here i want to change g_noclip to 1 
//so and so 
   
g_noclip 1



LeaF-666 12-22-2009 16:35

Re: Changing Global
 
Thanks! But if i want to chech if g_noclip is 1?

This?
PHP Code:

public noclip(id)
{
      if(
g_noclip == 1)
      {
      
//so and so
      
}



ProIcons 12-22-2009 16:36

Re: Changing Global
 
if(equal(g_noclip,"1"))

platzpatrone 12-22-2009 16:40

Re: Changing Global
 
Quote:

Originally Posted by LeaF-666 (Post 1027387)
Thanks! But if i want to chech if g_noclip is 1?

This?
PHP Code:

public noclip(id)
{
      if(
g_noclip == 1)
      {
      
//so and so
      
}



yes

YamiKaitou 12-22-2009 16:41

Re: Changing Global
 
Quote:

Originally Posted by LeaF-666 (Post 1027387)
Thanks! But if i want to chech if g_noclip is 1?

This?
PHP Code:

public noclip(id)
{
      if(
g_noclip == 1)
      {
      
//so and so
      
}



Yes

Quote:

Originally Posted by ProIcons (Post 1027390)
if(equal(g_noclip,"1"))

No

Doc-Holiday 12-22-2009 16:44

Re: Changing Global
 
Also if g_noclip will never be set to more then 1 or 0

PHP Code:

if(g_noclip)
{
   
//Do something if noclip 1 or greater
}
else if(!
g_noclip)
{
   
//do something if noclip 0



ProIcons 12-22-2009 16:44

Re: Changing Global
 
ok:p

minimiller 12-22-2009 16:50

Re: Changing Global
 
fyi
if u make it a bool u can do this sort of thing
PHP Code:

new bool:gbNoclip[33];

public 
noclip(id)
{
    
gbNoclip[id] = !gbNoclip[id];


this toggles it on and off
then if u were planning on adding noclip:
PHP Code:

new bool:gbNoclip[33];

public 
noclip(id)
{
    
gbNoclip[id] = !gbNoclip[id];
    
set_user_noclip(idgbNoclip[id]);



LeaF-666 12-22-2009 17:00

Re: Changing Global
 
Thank you all! :mrgreen:
It works now!


All times are GMT -4. The time now is 04:11.

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