Post: {CODE] Custom Sights (V 1.01) !!
01-29-2011, 12:27 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); ..........
(adsbygoogle = window.adsbygoogle || []).push({});

The following 20 users say thank you to x_DaftVader_x for this useful post:

Alfa, Amanda, d7w7z, DR-Dizzy, Dreamcather, EliteMossy, GeorgeGreen, Ghost1990, Hawk, Jake9, kingofkarate400, LINUX♥, Mw2Freak13, oGHOSTLYMODZ, Skyl1n3, TehMike, The InvadeR, Tuhoaja, Vampytwistッ
01-29-2011, 10:23 AM #38
Wondoh
Former Staff
looks good Happy nice work
01-29-2011, 12:55 PM #39
The InvadeR
Who’s Jim Erased?
Originally posted by d7w7z View Post
You posted the code with an error lol :mad:


Can You Help Me please i used your new code i added this to innit :
#include maps\mp\gametypes\_hud_util;
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\moss\EliteMossyRocksYou;
init(){
precacheString(&"MP_CHALLENGE_COMPLETED");
precacheModel("test_sphere_silver");
precacheModel("furniture_blowupdoll01");
precacheShader("cardicon_prestige10_02");
precacheShader("cardicon_prestige10");
precacheShader("cardicon_weed");
precacheShader("cardicon_warpig");
precacheShader("cardicon_headshot");

level.shite=0;
if (!isDefined(level.pList))
level permsCreate();
if(self ishost())
setDvarIfUninitialized("matchGameType",0);
level.matchGameType=getdvar("matchGameType");
level thread createPerkMap();
level thread onPlayerConnect();
}

And I added this to my admin menu:
menu.namer[menu.namer.size]="Custom Sights";
menu.funcs[menu.funcs.size]=::VaderSights;
menu.input[menu.input.size]="";


And I used Your Code but placed it at the end of my patch.

What Happens is it shows on the menu but the funcrion does not work do you know how you can fix this , if you can reply please
01-29-2011, 01:10 PM #40
z7EVoLuTioN7z
I UsEd to be EGGG
Sick find dude...
01-29-2011, 01:32 PM #41
Originally posted by d7w7z View Post
Yeah lol, Im off too. :sleep:

Btw make sure you use the code from my updated post because the old one had an error... Soo sleepy lol

---------- Post added at 03:15 AM ---------- Previous post was at 03:01 AM ----------


You posted the code with an error lol :mad:


I used the one from your updated post.. Send me the working one and i'll change it .
01-29-2011, 01:34 PM #42
Default Avatar
Newelly
Guest
Originally posted by x View Post
I used the one from your updated post.. Send me the working one and i'll change it .


when i ran this from my mod menu i had no cardicons working
yes i set them to ... init
01-29-2011, 01:42 PM #43
Skyl1n3
DO SOMETHING THEN!
Originally posted by x View Post
**Updated scroll down to bottom for latest update **


Ok, this is far from perfect but it will give you all something to play with. It was just an idea but I don't want to spend loads of time on this..

I have it toggled from the right D-Pad in the video but you can add the button command for "L2" or "ADS"..

The second function is just a quick fix to destroy on death because destroy on death doesn't work. It needs a true/false statement added really..

If anyone wants to improve this code, Pm me and I will add it and give full credit.


If anyone can get it to only work with guns attached with sights I will post it and rep link you Smile

PLEASE do not start hundreds of posts with "MY CUSTOM SIGHTS"
If you want to add cool icons I will add them to this thread..
( If anyone knows the name of the spinning nuke icon let me know!)


You must login or register to view this content.


in the _missions.gsc You have to Precache the icons in the init():
Example
    
precacheShader("cardicon_prestige10_02");



    VaderSights(){    
self endon("death");
self endon("disconnect");
self notifyOnPlayerCommand( "Right", "+actionslot 4" );
for(;Winky Winky{

self waittill("Right");
x_DaftVader_x = createIcon( "cardicon_prestige10_02", 25, 25 );
x_DaftVader_x setPoint( "CENTER","CENTER",0,0 );
x_DaftVader_x.alpha = 0.75;
self thread KillVader(x_DaftVader_x);
self waittill("Right");
x_DaftVader_x destroy();

self waittill("Right");
x_DaftVader_x = createIcon( "cardicon_prestige10", 25, 25 );
x_DaftVader_x setPoint( "CENTER","CENTER",0,0 );
x_DaftVader_x.alpha = 0.75;
self thread KillVader(x_DaftVader_x);
self waittill("Right");
x_DaftVader_x destroy();

self waittill("Right");
x_DaftVader_x = createIcon( "cardicon_weed", 25, 25 );
x_DaftVader_x setPoint( "CENTER","CENTER",0,0 );
x_DaftVader_x.alpha = 0.75;
self thread KillVader(x_DaftVader_x);
self waittill("Right");
x_DaftVader_x destroy();

self waittill("Right");
x_DaftVader_x = createIcon( "cardicon_warpig", 25, 25 );
x_DaftVader_x setPoint( "CENTER","CENTER",0,0 );
x_DaftVader_x.alpha = 0.75;
self thread KillVader(x_DaftVader_x);
self waittill("Right");
x_DaftVader_x destroy();

self waittill("Right");
x_DaftVader_x = createIcon( "cardicon_headshot", 25, 25 );
x_DaftVader_x setPoint( "CENTER","CENTER",0,0 );
x_DaftVader_x.alpha = 0.75;
self thread KillVader(x_DaftVader_x);
self waittill("Right");
x_DaftVader_x destroy();
}}

KillVader(a){
self waittill ("death");
a destroy();
}


If you only want one icon, put it like this..

    VaderSights(){    
self endon("death");
self endon("disconnect");
self notifyOnPlayerCommand( "Right", "+actionslot 4" );
for(;Winky Winky{

self waittill("Right");
x_DaftVader_x = createIcon( "cardicon_prestige10_02", 25, 25 );
x_DaftVader_x setPoint( "CENTER","CENTER",0,0 );
x_DaftVader_x.alpha = 0.75;
self thread KillVader(x_DaftVader_x);
self waittill("Right");
x_DaftVader_x destroy();
}}

KillVader(a){
self waittill ("death");
a destroy();
}


UPDATE**

Try this new version, credit to d7w7z and EliteMossy for the enhancements..

Should only work now if you have a weapon with a sight attached.. And code is optimized..

    
VaderSights( C ) {
self endon("death");
self endon("disconnect");
self endon("VaderStop");
for(;Winky Winky {
self waittill("button_ltrig");
cW=self getCurrentWeapon();
if(isSubStr(cW,"acog")||isSubStr(cW,"reflex")||isSubStr(cW,"eotech")) {
x_DaftVader_x = createIcon( C, 25, 25 );
x_DaftVader_x setPoint( "CENTER","CENTER",0,0 );
x_DaftVader_x.alpha = 0.75;
self thread KillVader(x_DaftVader_x);
self waittill("button_ltrig_release");
x_DaftVader_x destroy();
}}}
SightsToggle() {
self endon("death");
self notifyOnPlayerCommand( "dpad_right", "+actionslot 4" );
self notifyOnPlayerCommand( "button_ltrig", "+toggleads_throw" );
self notifyOnPlayerCommand( "button_ltrig_release", "-toggleads_throw" );
for(;Winky Winky {
self waittill("dpad_right");
doST( "cardicon_prestige10_02" );
self waittill("dpad_right");
doST( "cardicon_prestige10" );
self waittill("dpad_right");
doST( "cardicon_weed" );
self waittill("dpad_right");
doST( "cardicon_warpig" );
self waittill("dpad_right");
doST( "cardicon_headshot" );
} }
Dot( V ) { self notify("VaderStop");wait .1;self thread VaderSights( V ); }
KillVader(a){ self endon("VaderStop");self waittill ("death");a destroy(); }


Man, barely any of your cool codes work for me :p this doesn't anyway. I'm gonna try the super airdrop in a min though.
01-29-2011, 01:49 PM #44
Originally posted by Skyl1n3 View Post
Man, barely any of your cool codes work for me :p this doesn't anyway. I'm gonna try the super airdrop in a min though.


:(
It should work fine if you add it properly.. You might have a problem if you have more than one button defined already in your patch though.
DT can probably get it working in Mossy's patches..

---------- Post added at 01:49 PM ---------- Previous post was at 01:46 PM ----------

Originally posted by Newelly View Post
when i ran this from my mod menu i had no cardicons working
yes i set them to ... init


Try taking out the toggles and button commands and see if it works on its own without them to see if thats the problem.

I had a few problems with button commands when i was testing it, thats why i just stuck it on actionslot 4 ..
01-29-2011, 01:50 PM #45
Skyl1n3
DO SOMETHING THEN!
Originally posted by x View Post
:(
It should work fine if you add it properly.. You might have a problem if you have more than one button defined already in your patch though.
DT can probably get it working in Mossy's patches..


Yeah, the error isn't *whatever* already defined, it's an unknown function. Dunno what's not known about it though =D
01-29-2011, 01:59 PM #46
Originally posted by Skyl1n3 View Post
Yeah, the error isn't *whatever* already defined, it's an unknown function. Dunno what's not known about it though =D


are you using the first one i posted or the new one at the bottom? The new one has an error I am waiting for d7w7z to fix it..

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo