SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 09/07/2018, 10:05 AM   #1
Kristall
Little Clucker
 
Kristall's Avatar
 
Join Date: Mar 2018
Location: Romania
Posts: 10
Reputation: 1
Default Deer Hunter Job

(JOB): Deer Hunter


Hello! I'm back with a new FS.

In this new FS, is a new job, inspired on Nephrite Servers (JADE/RUBY).


Commands / Money

- [/getjob] - to get Hunter Job
- [/quitjob] - give up
- [/work] - to start hunting

Money:
- if u kill Deep from a distance lower than 20m, u failed and you don't receive your money
- if u kill Deep from a distance between [20, 39]m, u will get $1000 + a random part of 500$ (u can edit that)
- if u kill Deep from a distance bigger than 40m, u will got a bonus in money


Video:

https://www.*******.com/watch?v=VQcyGT6aDpQ


pastebin: https://pastebin.com/ydALKsMG

**sorry for last topic, i forgot to put pastebin and i screw up with tittle
***I will update the FS in few days, making deers move, making it harder to fire them
Kristall is offline   Reply With Quote
Old 10/07/2018, 04:25 PM   #2
CodeStyle175
Banned
 
Join Date: Apr 2014
Posts: 481
Reputation: 35
Default Re: Deer Hunter Job

again wtf is this shit?
why are you repeating useless code liks this?
PHP Code:
     if(PRESSED(KEY_WALK)) {
        if(
Deep_Deer[playerid] == 1) {
            if(
IsPlayerInRangeOfPoint(playerid3.52046.7698, -799.4532126.7188) && Deer[playerid] == 1) {
                
TogglePlayerControllable(playerid0);
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.52021.1818, -494.020776.1904) && Deer[playerid] == 2) {
                
TogglePlayerControllable(playerid0);
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.51632.5769, -599.744461.8233) && Deer[playerid] == 3) {
                
TogglePlayerControllable(playerid0);
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.51741.4386, -979.581736.6115) && Deer[playerid] == 4) {
                
TogglePlayerControllable(playerid0);
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.52553.6780, -963.433881.6685) && Deer[playerid] == 5) {
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
TogglePlayerControllable(playerid0);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.52637.4963, -380.219557.9261) && Deer[playerid] == 6) {
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
TogglePlayerControllable(playerid0);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.52406.9773, -403.468172.1762) && Deer[playerid] == 7) {
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
TogglePlayerControllable(playerid0);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }
         }
     } 
can be done this
PHP Code:
if(Deep_Deer[playerid] == 1) {
        if(
IsPlayerInRangeOfPoint(playerid3.52046.7698, -799.4532126.7188) && Deer[playerid] == || 
        
IsPlayerInRangeOfPoint(playerid3.52021.1818, -494.020776.1904) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.51632.5769, -599.744461.8233) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.51741.4386, -979.581736.6115) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.52553.6780, -963.433881.6685) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.52637.4963, -380.219557.9261) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.52406.9773, -403.468172.1762) && Deer[playerid] == 7){
            
TogglePlayerControllable(playerid0);
            
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
            
Deep_Deer[playerid] = 0;
            
KillTimer(Meeters_BTWDeer[playerid]);
            
Shoot_Deer[playerid] = 0;
            
SetTimer("Done_Deer"3500false);
        }
    } 
CodeStyle175 is offline   Reply With Quote
Old 11/07/2018, 04:23 PM   #3
iNkyz
Little Clucker
 
Join Date: Jun 2018
Posts: 21
Reputation: 0
Default Re: Deer Hunter Job

Where did you get that weapon color lol!
iNkyz is offline   Reply With Quote
Old 20/07/2018, 02:55 PM   #4
Kristall
Little Clucker
 
Kristall's Avatar
 
Join Date: Mar 2018
Location: Romania
Posts: 10
Reputation: 1
Default Re: Deer Hunter Job

Quote:
Originally Posted by CodeStyle175 View Post
again wtf is this shit?
why are you repeating useless code liks this?
PHP Code:
     if(PRESSED(KEY_WALK)) {
        if(
Deep_Deer[playerid] == 1) {
            if(
IsPlayerInRangeOfPoint(playerid3.52046.7698, -799.4532126.7188) && Deer[playerid] == 1) {
                
TogglePlayerControllable(playerid0);
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.52021.1818, -494.020776.1904) && Deer[playerid] == 2) {
                
TogglePlayerControllable(playerid0);
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.51632.5769, -599.744461.8233) && Deer[playerid] == 3) {
                
TogglePlayerControllable(playerid0);
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.51741.4386, -979.581736.6115) && Deer[playerid] == 4) {
                
TogglePlayerControllable(playerid0);
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.52553.6780, -963.433881.6685) && Deer[playerid] == 5) {
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
TogglePlayerControllable(playerid0);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.52637.4963, -380.219557.9261) && Deer[playerid] == 6) {
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
TogglePlayerControllable(playerid0);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }else if(
IsPlayerInRangeOfPoint(playerid3.52406.9773, -403.468172.1762) && Deer[playerid] == 7) {
                
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
                
TogglePlayerControllable(playerid0);
                
Deep_Deer[playerid] = 0;
                
KillTimer(Meeters_BTWDeer[playerid]);
                
Shoot_Deer[playerid] = 0;
                
SetTimer("Done_Deer"3500false);
            }
         }
     } 
can be done this
PHP Code:
if(Deep_Deer[playerid] == 1) {
        if(
IsPlayerInRangeOfPoint(playerid3.52046.7698, -799.4532126.7188) && Deer[playerid] == || 
        
IsPlayerInRangeOfPoint(playerid3.52021.1818, -494.020776.1904) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.51632.5769, -599.744461.8233) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.51741.4386, -979.581736.6115) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.52553.6780, -963.433881.6685) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.52637.4963, -380.219557.9261) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.52406.9773, -403.468172.1762) && Deer[playerid] == 7){
            
TogglePlayerControllable(playerid0);
            
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
            
Deep_Deer[playerid] = 0;
            
KillTimer(Meeters_BTWDeer[playerid]);
            
Shoot_Deer[playerid] = 0;
            
SetTimer("Done_Deer"3500false);
        }
    } 
Every time I finish doing an FS, I look around the code and realize that I could very easily reduce the number of lines exactly as you did. Thank you for your referral, and next time I'm going to try not to throw any unnecessary code lines. See' ya!
Kristall is offline   Reply With Quote
Old 21/07/2018, 12:52 PM   #5
DBZdabIt3Bro7
Banned
 
Join Date: Sep 2017
Location: Lovely name, right?
Posts: 76
Reputation: 8
Default Re: Deer Hunter Job

Quote:
Originally Posted by Kristall View Post
Every time I finish doing an FS, I look around the code and realize that I could very easily reduce the number of lines exactly as you did. Thank you for your referral, and next time I'm going to try not to throw any unnecessary code lines. See' ya!
erm, that code is just even more terrible


PHP Code:
// global variable
new Float:deerLocations[][] = {
    { 
0.00.00.0 // id 0 (invalid) (ps: always start your IDs from 0 and up, if you need one that's invalid, refer to use negative 1 (-1)

    
2046.7698, -799.4532126.7188 // deer 1
    
2021.1818, -494.020776.1904 // deer 2
    
{1632.5769, -599.744461.8233 // deer 3
    
1741.4386, -979.581736.6115 // deer 4
    
2553.6780, -963.433881.6685 // deer 5
    
2637.4963, -380.219557.9261 // deer 6
    
2406.9773, -403.468172.1762 // deer 7
};

// local execution

    
if(Deep_Deer[playerid] != 1)
        return 
false;
    
    if(
IsPlayerInRangeOfPoint(playerid3.5deerLocations[Deer[playerid][0], deerLocations[Deer[playerid][1], deerLocations[Deer[playerid][2])) { 
        
TogglePlayerControllable(playerid0); 
        
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110); 

        
Deep_Deer[playerid] = 0
        
Shoot_Deer[playerid] = 0

        
KillTimer(Meeters_BTWDeer[playerid]); 
        
SetTimer("Done_Deer"3500false); 
    } 
also for hte love of god, use line breaks.




for future releases, don't release anything unless the code has been optimized for best performance. i haven't checked the code at all, but just seeing this was tearing my eyes. gl.


_________________
Quote:
Originally Posted by CodeStyle175 View Post
again wtf is this shit?
PHP Code:
if(Deep_Deer[playerid] == 1) {
        if(
IsPlayerInRangeOfPoint(playerid3.52046.7698, -799.4532126.7188) && Deer[playerid] == || 
        
IsPlayerInRangeOfPoint(playerid3.52021.1818, -494.020776.1904) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.51632.5769, -599.744461.8233) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.51741.4386, -979.581736.6115) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.52553.6780, -963.433881.6685) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.52637.4963, -380.219557.9261) && Deer[playerid] == ||
        
IsPlayerInRangeOfPoint(playerid3.52406.9773, -403.468172.1762) && Deer[playerid] == 7){
            
TogglePlayerControllable(playerid0);
            
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
            
Deep_Deer[playerid] = 0;
            
KillTimer(Meeters_BTWDeer[playerid]);
            
Shoot_Deer[playerid] = 0;
            
SetTimer("Done_Deer"3500false);
        }
    } 
no, that's not how math queries work, you're asking the server:
if (player is in range of coord) and (variable deer is x) or (player is in range of coord) and (variable deer is x)
that's to say, if player is in range of coord and variable deer isn't x but player also is in range of second coord, then do this. (this would ofc be looped several times) and in the end your math query won't make any sense (the if statement) so to make your code actually run properly (to be noticed, this kind of if statement is not recommended and is bad practice.)
PHP Code:
if(Deep_Deer[playerid] == 1) {
        if((
IsPlayerInRangeOfPoint(playerid3.52046.7698, -799.4532126.7188) && Deer[playerid] == 1) || 
        (
IsPlayerInRangeOfPoint(playerid3.52021.1818, -494.020776.1904) && Deer[playerid] == 2) ||
        (
IsPlayerInRangeOfPoint(playerid3.51632.5769, -599.744461.8233) && Deer[playerid] == 3) ||
        (
IsPlayerInRangeOfPoint(playerid3.51741.4386, -979.581736.6115) && Deer[playerid] == 4) ||
        (
IsPlayerInRangeOfPoint(playerid3.52553.6780, -963.433881.6685) && Deer[playerid] == 5) ||
        (
IsPlayerInRangeOfPoint(playerid3.52637.4963, -380.219557.9261) && Deer[playerid] == 6) ||
        (
IsPlayerInRangeOfPoint(playerid3.52406.9773, -403.468172.1762) && Deer[playerid] == 7)){

        
TogglePlayerControllable(playerid0);
        
ApplyAnimation(playerid"BOMBER""BOM_Plant"4.1111110);
        
Deep_Deer[playerid] = 0;
        
KillTimer(Meeters_BTWDeer[playerid]);
        
Shoot_Deer[playerid] = 0;
        
SetTimer("Done_Deer"3500false);
    }

DBZdabIt3Bro7 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Deer Hunting ! Dinnozor Filterscripts 53 15/07/2016 11:01 AM
Deer moving backwards. kvann Scripting Help 0 04/06/2014 11:39 AM
[FilterScript] Transformation Into A Deer LevPopov Filterscripts 8 13/12/2013 03:36 PM
Deer hunter 2005 sesion anyone? D: Rozzie Everything and Nothing 2 26/12/2008 12:02 AM


All times are GMT. The time now is 04:01 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.