IsPlayerNearAnyRobberyArea
#1

custom function i made
pawn Код:
IsPlayerNearAnyRobberyArea(playerid)
{
        if( IsPlayerInRangeOfPoint( playerid, 3.0, 381.647399, -56.551239, 1001.515136) || IsPlayerInRangeOfPoint( playerid, 3.0, 810.491821, -1616.179199, 13.546875) || IsPlayerInRangeOfPoint( playerid, 3.0, 1070.025268, 249.608657, 536.092712) )
        {
            return true; //if player is near we will return true;
        }
         return false;
}
CMD:robstore(playerid,params[])
{
    if(gteam[playerid] != TEAM_CIV) return SendClientMessage(playerid,COLOR_RED,"(Error): You must be civilian to use this command!");
    if(!IsPlayerNearAnyRobberyArea(playerid)) return ErrorMessages(playerid,5);
    if(GetPlayerWantedLevel(playerid) >= 3) return ErrorMessages(playerid,7);
    if(alreadyrobbed[playerid] && gettime() < alreadyrobbed[playerid])return SendClientMessage(playerid,COLOR_RED,"(Error): You have already robbed a shop!Try Later!");
    if(Player_CountDown[playerid] != -1) return SendClientMessage(playerid, COLOR_RED, "(Error): Please wait until the robbery you've started gets finished.");
    Player_CountDown[playerid] = 30;
    PlayerTimer_CountDown[playerid] = SetTimerEx("countdown", 1000, true, "i", playerid);
    SetPlayerProgressBarValue(playerid,bar[playerid],0);
    ShowPlayerProgressBar(playerid,bar[playerid]);
    IncreasePlayerWantedLevel(playerid,4);
    alreadyrobbed[playerid] = gettime() + 120;
    SendClientMessage(playerid,-1," ("COL_GREEN"WAIT"COL_WHITE"): Please stay at the point for 30 seconds if you want the robbery to be completed!");
    GameTextForPlayer(playerid,"~r~Starting Robbery!",1000,6);
    return 1;
}
Eventhough it compiles it says i am not near the robbery point... which i actually am..
Reply
#2

pawn Код:
IsPlayerNearAnyRobberyArea(playerid)
{
        if( IsPlayerInRangeOfPoint( playerid, 3.0, 381.647399, -56.551239, 1001.515136) || IsPlayerInRangeOfPoint( playerid, 3.0, 810.491821, -1616.179199, 13.546875) || IsPlayerInRangeOfPoint( playerid, 3.0, 1070.025268, 249.608657, 536.092712) )
        {
            return true; //if player is near we will return true;
        }
         return false;
}
In these lines, Why are you using return true/false? Just make it normal, return 1;

That was my suggestion, I am not sure.
Reply
#3

Quote:
Originally Posted by Teemo
Посмотреть сообщение
pawn Код:
IsPlayerNearAnyRobberyArea(playerid)
{
        if( IsPlayerInRangeOfPoint( playerid, 3.0, 381.647399, -56.551239, 1001.515136) || IsPlayerInRangeOfPoint( playerid, 3.0, 810.491821, -1616.179199, 13.546875) || IsPlayerInRangeOfPoint( playerid, 3.0, 1070.025268, 249.608657, 536.092712) )
        {
            return true; //if player is near we will return true;
        }
         return false;
}
In these lines, Why are you using return true/false? Just make it normal, return 1;

That was my suggestion, I am not sure.
I don't really think thats the problem.. lol
Reply
#4

Well, That's was my suggestion, Because I had a same code like that (IsPlayerAt24/7), But i don't remember
Reply
#5

It will only check for these 3 points and not any other (in your previous thread, you looped through the RobberyPoints array).

I'd suggest you to use dynamic checkpoints for the robbery points so you'll know for sure that you are in a point and if the player exits before 30 seconds pass, cancel the robbery.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)