Results 1 to 10 of 15

Thread: MODDING : How to make virtual money.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #14
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Quote Originally Posted by igstyga View Post
    Only 8 years late to the thread... I'm working on a similar mod but for S&D gametype. The problem is that player.money is set to 0 each round because PlayerConnect is being called after each spawn. No clue on that...
    I've solved it by saving the money into server cvars, but doesn't seem like an elegant solution.

    Anyone has a better idea?
    You can try storing money in global variables, I don’t know how good this idea is
    PHP Code:
    getID()
    {
        return 
    self getEntityNumber();
    }

    onPlayerConnect()
    {
        
    id self getID();
        
    level.money[id] = 0;
    }

    onPlayerDisconnect()
    {
        
    id self getID();
        
    level.money[id] = undefined;
    }

    Killed(/*...*/)
    {
        if (
    mod == "headshot")
            
    money 100;
        else if (
    mod == "melee")
            
    money 200;
        else 
            
    money 50;
        
        
    id self getID();
        
    level.money[id] += money;

    Last edited by maxdamage99; 18th June 2020 at 06:50.
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  2. The Following User Says Thank You to maxdamage99 For This Useful Post:

    kung foo man (18th June 2020)

Posting Permissions

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