[FilterScript] Drop weapon system
#1

Drop weapon system



Hello! In this topic I will present a system created by me.
It is a drop weapons system.
Short presentation: when you die, your weapons are thrown away and if you press the ALT key you can throw weapons
Look at the video for more information.


https://www.youtube.com/watch?v=vlMy5yOeyJ4

Download
Pastebin: http://pastebin.com/aTqczrEa
Zippyshare: http://www46.zippyshare.com/v/zaVHgg8p/file.html

Reply
#2

Hello. It's look good but you can do some optimization to your code.
Code:
WeaponObject(wid) {
    if(wid == 1) return 331;
    else if(wid == 2) return 332;
    else if(wid == 3) return 333;
    else if(wid == 5) return 334;
    else if(wid == 6) return 335;
    else if(wid == 7) return 336;
    else if(wid == 10) return 321;
    else if(wid == 11) return 322;
    else if(wid == 12) return 323;
    else if(wid == 13) return 324;
    else if(wid == 14) return 325;
    else if(wid == 15) return 326;
    else if(wid == 23) return 347;
    else if(wid == 24) return 348;
    else if(wid == 25) return 349;
    else if(wid == 26) return 350;
    else if(wid == 27) return 351;
    else if(wid == 28) return 352;
    else if(wid == 29) return 353;
    else if(wid == 30) return 355;
    else if(wid == 31) return 356;
    else if(wid == 32) return 372;
    else if(wid == 33) return 357;
    else if(wid == 4) return 335;
    else if(wid == 34) return 358;
    else if(wid == 41) return 365;
    else if(wid == 42) return 366;
    else if(wid == 43) return 367;
    return 0;
}
You could simply change it in switch would be much more good and efficient.
Reply
#3

Nicely done.
Reply
#4

Nice filterscript i will try to my server.
Reply
#5

Awesome! Keep up the good work +rep
Reply
#6

Ok it`s nice, I really like it, but do some optimisation, first thing, reduce statement if with loop switch, second thing is instead of using "function", use stock.
Reply
#7

Quote:
Originally Posted by Sanady
View Post
Ok it`s nice, I really like it, but do some optimisation, first thing, reduce statement if with loop switch, second thing is instead of using "function", use stock.
https://sampforum.blast.hk/showthread.php?tid=570635

No more to say
Reply
#8

Could be better, anyway well done
Reply
#9

Quote:
Originally Posted by Humza
View Post
Hello. It's look good but you can do some optimization to your code.
Code:
WeaponObject(wid) {
    if(wid == 1) return 331;
    else if(wid == 2) return 332;
    else if(wid == 3) return 333;
    else if(wid == 5) return 334;
    else if(wid == 6) return 335;
    else if(wid == 7) return 336;
    else if(wid == 10) return 321;
    else if(wid == 11) return 322;
    else if(wid == 12) return 323;
    else if(wid == 13) return 324;
    else if(wid == 14) return 325;
    else if(wid == 15) return 326;
    else if(wid == 23) return 347;
    else if(wid == 24) return 348;
    else if(wid == 25) return 349;
    else if(wid == 26) return 350;
    else if(wid == 27) return 351;
    else if(wid == 28) return 352;
    else if(wid == 29) return 353;
    else if(wid == 30) return 355;
    else if(wid == 31) return 356;
    else if(wid == 32) return 372;
    else if(wid == 33) return 357;
    else if(wid == 4) return 335;
    else if(wid == 34) return 358;
    else if(wid == 41) return 365;
    else if(wid == 42) return 366;
    else if(wid == 43) return 367;
    return 0;
}
You could simply change it in switch would be much more good and efficient.
No.

In this case, SWITCH must be used. It has better performance(faster) and readability...

IF checks EVERY case, but SWITCH goes directly to the correct one.
Reply
#10

Good job!
Reply
#11

Quote:
Originally Posted by Henrik96
Посмотреть сообщение
Good job!
thank you
Reply
#12

I have a script like this but except I use dynamicobjects rather rhan pickups look more realistic than pickups
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)