RobbedRecently Function (Some Problem)
#5

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
Just read over it, looks fine, I just dont know why you compare "zone_name" like integers

The problem with the enum was that if you set an value in the enum it is the index, means that all constants of the enum pointed to the index 0, thus changing all

Could you tell me what exactly isnt working with the command anymore?
Do you get the Unknown command response, did you checked any case with the crash dedect plugin ?
If no way works use prints till you find the line where the code stops
I did some debug, and the debug stops and doesn't show when the function zone[...][...] >= ... but when i tried doing zone[...][...] == .. || zone[...][...] == .. the command works

Code that doesn't work
pawn Код:
if(IsPlayerInDynamicCP(playerid, rCheckpoints[7]))
{
    if(zones[current_zone][zone_name] >= zones[93][zone_name] && zones[current_zone][zone_name]  <= zones[95][zone_name]) //Espelanade East Tatoo Shop
    {
        if(RobbedRecently[TatooRobbedRecently] >= 1) return SendClientMessage(playerid, COLOR_RED, "Error"COL_WHITE": This shop/store has been robbed recently, please try again later!");
        Robbing[playerid][RobbingTatoo] = 20;
        RobbedRecently[TatooRobbedRecently] = 300;

        format(string,sizeof(string),"[DISPATCH]"COL_GREY": There's a robbery in progress! Suspect: %s | Shop Name: Tatoo Shop | Shop Location: %s",PlayerName(playerid), playerid, GetZoneName(playerid));
        SendLEOMessage(string);

        TextDrawShowForPlayer(playerid, RobberyTD[playerid]);
        SetPlayerAttachedObject(playerid, 1, 1550, 1, 0.1, -0.2, 0, 0, 90, 0.5, 0.8, 0.8, 0.8);
        ApplyAnimation(playerid, "SHOP", "ROB_Shifty", 3.0, 0, 0, 0, 0, 0, 1);
    }
}
Code that does work
pawn Код:
if(IsPlayerInDynamicCP(playerid, rCheckpoints[7]))
{
    if(zones[current_zone][zone_name] == zones[93][zone_name] || zones[current_zone][zone_name]  == zones[94][zone_name] ||
    zones[current_zone][zone_name]  == zones[95][zone_name]) //Espelanade East Tatoo Shop
    {
        if(RobbedRecently[TatooRobbedRecently] >= 1) return SendClientMessage(playerid, COLOR_RED, "Error"COL_WHITE": This shop/store has been robbed recently, please try again later!");
        Robbing[playerid][RobbingTatoo] = 20;
        RobbedRecently[TatooRobbedRecently] = 300;

        format(string,sizeof(string),"[DISPATCH]"COL_GREY": There's a robbery in progress! Suspect: %s | Shop Name: Tatoo Shop | Shop Location: %s",PlayerName(playerid), playerid, GetZoneName(playerid));
        SendLEOMessage(string);

        TextDrawShowForPlayer(playerid, RobberyTD[playerid]);
        SetPlayerAttachedObject(playerid, 1, 1550, 1, 0.1, -0.2, 0, 0, 90, 0.5, 0.8, 0.8, 0.8);
        ApplyAnimation(playerid, "SHOP", "ROB_Shifty", 3.0, 0, 0, 0, 0, 0, 1);
    }
}
Simple Words:

I'm just making my code shorter
using >= 93 and 95 <= instead of == 93 or == 94 or == 95
Reply


Messages In This Thread
RobbedRecently Function (Some Problem) - by Patrick - 11.10.2013, 18:32
AW: RobbedRecently Function (Some Problem) - by Nero_3D - 11.10.2013, 20:39
Re: RobbedRecently Function (Some Problem) - by Patrick - 11.10.2013, 20:57
AW: RobbedRecently Function (Some Problem) - by Nero_3D - 11.10.2013, 21:31
Re: AW: RobbedRecently Function (Some Problem) - by Patrick - 11.10.2013, 21:37
AW: RobbedRecently Function (Some Problem) - by Nero_3D - 11.10.2013, 22:09
Re: RobbedRecently Function (Some Problem) - by Patrick - 11.10.2013, 23:16
AW: RobbedRecently Function (Some Problem) - by Nero_3D - 12.10.2013, 11:45
Re: AW: RobbedRecently Function (Some Problem) - by Patrick - 12.10.2013, 12:06

Forum Jump:


Users browsing this thread: 1 Guest(s)