Jump to content

global variable?


Recommended Posts

Posted

if anyone here knows pawno there is a command that i can do for example

  
  
new bool:first[MAX_PLAYERS]; 
  
  

so my question how do i make global variable for all players (a boolean, only true and false )

so then on player spawn i can do...

first[playerid] = true; 
  
--or 
  
if(first[thePlayer]==true) --etc... and so on.. 
  

i guess i mean by max_players is for each client

or something like that if anybody have understood me ? :P

Posted

I don't get you, what do you mean?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

ok so how can i do something like this in lua?

  
  
firstspawn = {} 
  
function player_Spawn ( posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension ) 
    if(firstspawn[source]) 
                --do stuff... 
                  firstspawn[source] = false;   
        end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn ) 
  
  

Posted

why u ask ? i know it doesnt work ! pls help me dont post useless -.-

  
  
if(firstspawn[source]) then 
        firstspawn[source] = false; 
        givePlayerMoney ( source, 10000 ) 
        outputChatBox("called?") 
        createBlipAttachedTo (source, 56) 
    end 
  
  

Posted

if(firstspawn[source]) then -- won't pass, ever.

if (not firstspawn[source]) then -- use this instead

firstspawn[source] = true -- do this after their first spawn so it won't run on their 2nd spawn.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...