Jump to content
Sign in to follow this  
Coding_Camel

Player Distance Markerpos

Recommended Posts

Hi, i'm trying to make a fishing script, but heres the problem. Even at its most basic form the only thing showing up is "script activated", and me being new to arma scripting, i'm sure its just one of those stupid beginner mistakes.

player groupchat "SCRIPT ACTIVATED!";

if (player distance getMarkerPos fish < 10) then {

player groupchat "FISH CAUGHT!";

};
else
{
player groupChat "You are not where the fish are!";
};

Share this post


Link to post
Share on other sites
player groupchat "SCRIPT ACTIVATED!";
If (Player Distance GetMarkerPos [color=#ff0000]"[/color]fish[color=#ff0000]"[/color] < 10) Then {Player GroupChat "FISH CAUGHT!"} Else {Player GroupChat "You are not where the fish are!"}

Edited by Iceman77

Share this post


Link to post
Share on other sites

player groupchat "SCRIPT ACTIVATED!"; If (Player Distance [b]([/b]GetMarkerPos [color=#ff0000]"[/color]fish[color=#ff0000]"[/color][b])[/b] < 10) Then {Player GroupChat "FISH CAUGHT!"} Else {player groupChat "You are not where the fish are!"}

Brackets are always good to have.

Share this post


Link to post
Share on other sites

technically, You don't need to use a ; behind the last statement in any given scope.

Share this post


Link to post
Share on other sites

So if I do

player groupchat "SCRIPT ACTIVATED!"; If (Player Distance (GetMarkerPos "fish") < 10) Then {
Player GroupChat "FISH CAUGHT!"
} 
Else 
{
player groupChat "You are not where the fish are!"
}

I wouldn't need the ;'s

Share this post


Link to post
Share on other sites

You don't need to use an ; after then evaluation. Only after the else evaluation if it's not the last statement in the scope that it's in.

---------- Post added at 11:29 ---------- Previous post was at 11:27 ----------

technically, You don't need to use a ; behind the last statement in any given scope.
So if I do

player groupchat "SCRIPT ACTIVATED!"; If (Player Distance (GetMarkerPos "fish") < 10) Then {
Player GroupChat "FISH CAUGHT!"
} 
Else 
{
player groupChat "You are not where the fish are!"
}

I wouldn't need the ;'s

That's correct

Share this post


Link to post
Share on other sites

Well I'd say it's good practice to add an ; after every if then (else) statement. But that's another argument :P

Share this post


Link to post
Share on other sites

It's good practice though to use a ; at the end of each statement regardless. That way you know everything is done properly, and less headaches if you go to edit the file at a later time.

---------- Post added at 11:37 ---------- Previous post was at 11:36 ----------

Now that's just ninja

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×