AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   My Scout Removal Script (https://forums.alliedmods.net/showthread.php?t=17332)

-X3N- | DEFAULT 08-29-2005 19:34

My Scout Removal Script
 
I cant see why this is removing ALL of the weapons on the map. It is called by set_task that loops every 0.5 seconds. Why is it removing ALL weapons? -Thanks

Code:
public Hidescout() {         new ent         ent = find_ent_by_model(33,"weaponbox","models/w_scout.mdl")         if(ent !=0){             call_think(ent)         } }
I saw a topic about weapon removal, but i believe that it only handles weapons on the ground at the map load.

And, if you're wondering WHY you would ever use this? Well, I own and run a surf server with a few altered mods on it =)

Zenith77 08-29-2005 20:35

try replacing the 0 with -1 ....

-X3N- | DEFAULT 08-29-2005 20:46

I assume you mean
Code:

if(ent !=0){
but i thought that ent would be zero if the find_ent_by_model is not found.

i tried changing that 0 to a -1, but no luck. All of the weaponboxes are being removed.

pdoubleopdawg 08-29-2005 20:51

I believe weaponbox is for just about every weapon or whatnot (May be wrong)

try the classname weapon_scout.

Zenith77 08-29-2005 20:55

i rember a topic about "0" how since 0 basically means false if you use it with the ! it does something with the binary...but i saw this like months ago on a site called cprograming

Hawk552 08-29-2005 20:59

Quote:

Originally Posted by Zenith77
i rember a topic about "0" how since 0 basically means false if you use it with the ! it does something with the binary...but i saw this like months ago on a site called cprograming

For once, I agree with Zenith. I think it should be !=-1, although I'm not sure.

-X3N- | DEFAULT 08-29-2005 21:16

I'm still trying things, I cant get anything that works, Hope one of the experts drop in and shake this all out.

XxAvalanchexX 08-29-2005 21:42

-1 is wrong, he should be checking if it's not 0 as he is.

"If none is found, 0 is returned"

Regardless, I don't know why it's not functioning properly.

-X3N- | DEFAULT 08-29-2005 21:59

Yeah, i knew it should be !=0, but im so stumped as to why it's not recognizing if it's a w_scout, and why it would be deleting ALL of the weaponboxes :x

-X3N- | DEFAULT 08-30-2005 13:57

Can nobody answer this? i figured this would be one of those quick answers....


All times are GMT -4. The time now is 14:22.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.