Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Need help for weapon wall

  1. #11
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Perhaps you better tell us what errors you encountered. We can only guess what the problem is, whereas you actually know!

    EDIT - OK, I can see straight away what the problem is - the code is being threaded from a map file, when in fact it needs to be a player. Asking the code to perform functions like getCurrentWeapon() can only be performed on a player - not a map.

    So, the code needs to be moved inside a file like a gametype file. And run the threads from some point like onPlayerSpawned().

    MODDING 101 - always thread code on the right entity. Otherwise, you will encounter a shit-load of errors.
    Last edited by Tally; 13th October 2014 at 18:19.

  2. #12
    Private pollo's Avatar
    Join Date
    Jul 2012
    Location
    Spain
    Posts
    116
    Thanks
    93
    Thanked 69 Times in 35 Posts
    Maybe is because you haven't defined the 'money' variable. It either has to be inside the mod or in the map script. I guess it isn't in the mod, so let's make it in the map script. Thread this in your main function

    PHP Code:
    main()
    {
    thread players();
    //blablabla (rest of the threads)
    }
    players()
    {
        while(
    1)
        {
        
    players getentarray("player","classname");
            for(
    i=0;i<players.size;i++)
            {
            
    players[i] = player;
                if(!
    isDefined(player.money))
                    
    player.money 0;
            }
        
    wait .5;
        }
    }

    //blablabla (rest of the functions) 
    Add as many variables as you want in the above func
    Now you can use this player variable wherever you want in the script, for example:
    PHP Code:
    bla()
    {
    trig getent("trig","targetname");
        while(
    1)
        {
        
    trig waittill("trigger",user);
            if(
    isdefined(user.money))
            {
                if(
    user.money >= 10)
                {
                
    //blablabla...
                
    }
            }
        }

    Last edited by pollo; 13th October 2014 at 19:41.

  3. #13
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by Tally View Post
    Perhaps you better tell us what errors you encountered. We can only guess what the problem is, whereas you actually know!
    I would like to suspend all answers from our side until we get an answer on this one. Its really problematic people saying "ive got a problem with this" - ye your pc has no power, your windows is not genuine or any of the 9001 other causes that can create such a mess.

    Debugging.

    Also, see my signature.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  4. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Loveboy (15th October 2014)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •