SA-MP Forums Archive
[HELP] with code. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] with code. (/showthread.php?tid=566291)



[HELP] with code. - SHFaCeBook - 04.03.2015

hello

help me

i want make this if player is not place, not work him
pawn Код:
if(IsAtDuty(playerid))
Like this :
pawn Код:
if(groupVariables[group][gGroupType] != 1) return SCM(playerid, COLOR_GREY, "You are not a cop!");

i did this, and not work
pawn Код:
if(IsAtDuty(playerid)) return SCM(playerid, COLOR_GREY, "You are not in HQ!");
and i am in HQ not work , say me ''You are Not in HQ"

any one help me , +rep.


Re: [HELP] with code. - BeesSi - 04.03.2015

Why dont you try

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, range, x, y, z)) return SCM(playerid, COLOR_GREY, "You are not in HQ!");



Re: [HELP] with code. - ReshiramZekrom - 04.03.2015

Try with:

pawn Код:
if(!IsAtDuty(playerid)) return SCM(playerid, COLOR_GREY, "You are not in HQ!");
If it doesn't work maybe the problem is in the function


Re: [HELP] with code. - SHFaCeBook - 04.03.2015

Quote:
Originally Posted by BeesSi
Посмотреть сообщение
Why dont you try

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, range, x, y, z)) return SCM(playerid, COLOR_GREY, "You are not in HQ!");
Because i have 2 points :
pawn Код:
stock IsAtDuty(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 100.0, 246.806, 107.572, 1003.219)) return 1;
    if(IsPlayerInRangeOfPoint(playerid, 100.0, 288.756,167.346,1007.172)) return 1;
    return 1;
}



Re: [HELP] with code. - BeesSi - 04.03.2015

Quote:
Originally Posted by SH********
Посмотреть сообщение
Because i have 2 points :
pawn Код:
stock IsAtDuty(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 100.0, 246.806, 107.572, 1003.219)) return 1;
    if(IsPlayerInRangeOfPoint(playerid, 100.0, 288.756,167.346,1007.172)) return 1;
    return 1;
}
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 100.0, 246.806, 107.572, 1003.219) || (IsPlayerInRangeOfPoint(playerid, 100.0, 288.756,167.346,1007.172))) return SCM(playerid, COLOR_GREY, "You are not in HQ!");
Compiled without error for me, try it by yourself.


Re: [HELP] with code. - SHFaCeBook - 04.03.2015

Quote:
Originally Posted by ReshiramZekrom
Посмотреть сообщение
Try with:

pawn Код:
if(!IsAtDuty(playerid)) return SCM(playerid, COLOR_GREY, "You are not in HQ!");
If it doesn't work maybe the problem is in the function
Thanks bro for answer and help , i tryed it , and is work in all place, if u are not in HQ is work


Re: [HELP] with code. - ReshiramZekrom - 04.03.2015

stock IsAtDuty(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 100.0, 246.806, 107.572, 1003.219)) return 1;
if(IsPlayerInRangeOfPoint(playerid, 100.0, 288.756,167.346,1007.172)) return 1;
return 0;
}
Change return 1 with 0


Re: [HELP] with code. - BeesSi - 04.03.2015

Thats because you have set your range to 100.0, try lower like 8.0 or 5.0


Re: [HELP] with code. - ReshiramZekrom - 04.03.2015

Otherwise if you wanna do without the stock you have to use quite the same thing that BeesSi wrotes, but remembere to put "!" before the function (it means that isn't right):

pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 100.0, 246.806, 107.572, 1003.219) || !IsPlayerInRangeOfPoint(playerid, 100.0, 288.756,167.346,1007.172)) return SCM(playerid, COLOR_GREY, "You are not in HQ!");
Nope, fail. It never will works sorry


Re: [HELP] with code. - SHFaCeBook - 04.03.2015

Quote:
Originally Posted by ReshiramZekrom
Посмотреть сообщение
stock IsAtDuty(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 100.0, 246.806, 107.572, 1003.219)) return 1;
if(IsPlayerInRangeOfPoint(playerid, 100.0, 288.756,167.346,1007.172)) return 1;
return 0;
}
Change return 1 with 0
Thanks +rep