Raised This Month: $ Target: $400
 0% 

Changing Global


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LeaF-666
Junior Member
Join Date: Dec 2009
Location: Bucharest, RO
Old 12-22-2009 , 13:56   Changing Global
Reply With Quote #1

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

LeaF-666 is offline
Send a message via Yahoo to LeaF-666
platzpatrone
Veteran Member
Join Date: Apr 2007
Location: Germany
Old 12-22-2009 , 14:09   Re: Changing Global
Reply With Quote #2

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

platzpatrone is offline
LeaF-666
Junior Member
Join Date: Dec 2009
Location: Bucharest, RO
Old 12-22-2009 , 16:35   Re: Changing Global
Reply With Quote #3

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
      
}

LeaF-666 is offline
Send a message via Yahoo to LeaF-666
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 12-22-2009 , 16:36   Re: Changing Global
Reply With Quote #4

if(equal(g_noclip,"1"))
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
platzpatrone
Veteran Member
Join Date: Apr 2007
Location: Germany
Old 12-22-2009 , 16:40   Re: Changing Global
Reply With Quote #5

Quote:
Originally Posted by LeaF-666 View Post
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
platzpatrone is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-22-2009 , 16:41   Re: Changing Global
Reply With Quote #6

Quote:
Originally Posted by LeaF-666 View Post
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 View Post
if(equal(g_noclip,"1"))
No
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 12-22-2009 , 16:44   Re: Changing Global
Reply With Quote #7

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

Doc-Holiday is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 12-22-2009 , 16:44   Re: Changing Global
Reply With Quote #8

ok:p
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 12-22-2009 , 16:50   Re: Changing Global
Reply With Quote #9

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]);

__________________
minimiller is offline
Send a message via MSN to minimiller
LeaF-666
Junior Member
Join Date: Dec 2009
Location: Bucharest, RO
Old 12-22-2009 , 17:00   Re: Changing Global
Reply With Quote #10

Thank you all!
It works now!
LeaF-666 is offline
Send a message via Yahoo to LeaF-666
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 04:11.


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