Results 1 to 6 of 6

Thread: Pickup Script

  1. #1
    Private
    Join Date
    Mar 2019
    Posts
    16
    Thanks
    2
    Thanked 3 Times in 3 Posts

    Pickup Script

    Hello,

    I'm trying to set up a Pickup script which made by IzNoGod and I'm getting the error

    Code:
    ******* script runtime error *******
    type undefined is not a vector: (file 'maps/mp/gametypes/_pickups.gsc', line 10)
        self.pickpoint=spawn("script_origin",self.origin);
                                                  *
    called from:
    (file 'maps/pam/sd.gsc', line 68)
     thread maps\mp\gametypes\_pickups::pickups();
            *
    called from:
    (file 'maps/mp/gametypes/_callbacksetup.gsc', line 15)
      [[level.callbackStartGameType]]();
              *
    started from:
    (file 'maps/mp/gametypes/_callbacksetup.gsc', line 10)
    CodeCallback_StartGameType()
    *
    ************************************
    Sys_Error: Error during initialization:
    script runtime error
    (see console for details)
    (file 'maps/mp/gametypes/_callbacksetup.gsc', line 10)

    The script:

    PHP Code:
    pickups()
    {
        
    self endon("disconnect");
        
    self endon("killed_player");
        
    self endon("spawned_player");
        
    self endon("spawned");
        
    picked=undefined;
        if(
    isdefined(self.pickpoint))
            
    self.pickpoint delete();
        
    self.pickpoint=spawn("script_origin",self.origin);
        
    dist=0;
        for(;;)
        {
            if(
    self usebuttonpressed())
            {
                if(!
    isdefined(picked))
                {
                    
    trace=bullettrace(self geteye()+(0,0,20),self geteye()+(0,0,20)+maps\mp\_utility::vectorscale(anglestoforward(self getplayerangles()),99999),true,self);
                    if(
    trace["fraction"]!=1)
                    {
                        if(
    isdefined(trace["entity"]))
                        {
                            if(
    isplayer(trace["entity"]))
                            {
                                
    picked=trace["entity"];
                                
    picked iprintlnbold("picked up by admin");
                                
    self iprintlnbold("you picked up ",picked.name);
                                
    self.pickpoint.origin=picked.origin;
                                
    picked linkto(self.pickpoint);
                                
    dist=distance(self.origin,picked.origin);
                            }
                        }
                    }
                }
                else
                {
                    if(!
    isplayer(picked)||!isalive(picked))
                        
    picked=undefined;
                    else
                    {
                        
    self.pickpoint.origin=self geteye()+maps\mp\_utility::vectorscale(anglestoforward(self getplayerangles()),dist);
                        if(
    self meleebuttonpressed())
                            
    dist+=15;
                        if(
    self attackbuttonpressed())
                        {
                            if(
    dist>50)
                                
    dist-=15;
                        }
                    }

                }
            }
            else if(
    isdefined(picked)||!isplayer(picked)||!isalive(picked))
            {
                if(!
    isplayer(picked))
                    
    picked=undefined;
                else
                {
                    
    picked unlink();
                    
    picked iprintlnbold("dropped by admin");
                    
    self iprintlnbold("you dropped ",picked.name);
                    
    picked=undefined;
                }
            }
            
    wait 0.05;
        }

    Any help? thanks
    Last edited by nerdiiii; 29th May 2019 at 22:56.

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

    kung foo man (30th May 2019)

  3. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    How do you actually call it in your script? E.g. player thread pickups();
    timescale 0.01

  4. #3
    Private
    Join Date
    Mar 2019
    Posts
    16
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Hey kung! Thanks for replying!

    I'm calling it from my SD.gsc like this
    Code:
    thread maps\mp\gametypes\_pickups::pickups();

  5. #4
    Private
    Join Date
    Jan 2018
    Location
    Somewhere
    Posts
    43
    Thanks
    10
    Thanked 21 Times in 16 Posts
    Code:
    thread dummy();
    self thread pickups();
    call it like this and should work, if not, try thread pickups();

  6. #5
    Private
    Join Date
    Jun 2013
    Posts
    70
    Thanks
    20
    Thanked 32 Times in 26 Posts
    the code says self endon("spawned_player");
    self endon("spawned");
    so put it in the spawnplayer function and it should work "after the notify spawned/spawned_player is called
    "
    Last edited by vanfreddy; 31st May 2019 at 13:31.

  7. The Following 2 Users Say Thank You to vanfreddy For This Useful Post:

    kung foo man (31st May 2019),Polat (31st May 2019)

  8. #6
    Private
    Join Date
    Jan 2018
    Location
    Somewhere
    Posts
    43
    Thanks
    10
    Thanked 21 Times in 16 Posts
    Or just self waittil("spawned_player");

Posting Permissions

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