Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

»
2 Active | 21 Guests
Online:

LATEST FORUM THREADS

»
Rainbow HELP....
CoD4 MP Mapping
water
CoD4 MP Mapping
ugw2gold
Starcraft 2

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access subscribe
Author Topic: [scriptsdump] admin pickup
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Monday, Jul. 4, 2011 07:12 am
Hey all
I decided to dump a lot of my scripts.
Here is the admin-pickup script:
Code:


pickups() //call this on an admin that needs adminpickup
{
        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);
	self iprintlnbold("^1Press ^5USE ^1to pick someone up!");
	wait 1;
	self iprintlnbold("^1Hold ^5MELEE^1 to move him further!");
	wait 1;
	self iprintlnbold("^1Hold ^5FIRE^1 to move him closer!");
		
        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("^1picked up by a admin");
                                                        self iprintlnbold("^1you 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("^5dropped by a admin");
                                self iprintlnbold("^5you dropped ",picked.name);
                                picked=undefined;
                        }
                }
                wait 0.05;
        }
}


Have fun
Questions can be either asked in this thread, or directly through xfire: imbackagainiba
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 12:52 am
Quote:
******* script compile error *******
uninitialised variable 'dist'
************************************
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 02:36 am
Ye, found that bug after the edit-time of my post ran out.

Just init the dist var by setting it to zero after/before one of the initial iprintlnbolds.
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 03:06 am
Code:
("script_origin",self.origin);
        dist=0;
	self iprintlnbold("^1Press ^5USE ^1to pick someone up!");

?
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 03:08 am
IzNoGoD writes...
Quote:

Just init the dist var by setting it to zero after/before one of the initial iprintlnbolds.


Initial=First
Just put dist=0; below the function declaration...
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 03:36 am
Now no error, but i not understand what do you script? In game i can't pickup enemy..

I added you script to .gsc and add it to _callbacksetup.gsc
What is wrong?

edited on Jul. 19, 2012 03:48 am by SanchoMLD
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 05:13 am
its a script dump bro, if you dont understand how to use the script you leave it alone for more experienced people. learn how to use it your self he shouldnt be giving step by steps in a script dump
Share |
SanchoMLD
General Member
Since: Jul 18, 2012
Posts: 22
Last: Jul 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 06:15 am
Quote:
if you dont understand how to use the script you leave it alone for more experienced people


Great help, thx guru!
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 06:48 am
There is only one comment in the whole script and you happen to fail to read/understand it.
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Thursday, Jul. 19, 2012 08:04 am
SanchoMLD writes...
Quote:
Quote:
if you dont understand how to use the script you leave it alone for more experienced people


Great help, thx guru!


no problem[wave]
Share |
Restricted Access Restricted Access subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Why console gaming is dying
Quote:Consider this: Dedicated gaming sales — including living-room consoles...
Devs: Games are being dumb...
Click 'read more' to view the contents of this post.
Loadout
Gun Crafting to the Max. edited on Sep. 25, 2012 06:57 pm by Morp...
Introducing the Source Fil...
Surprised this wasn't made a long time ago. Sounds like a nice little feature.
Introducing the Source Fil...
The Source Filmmaker (SFM) is the movie-making tool built and used by us he...

Partners & Friends

»