[HELP]Box Command
#1

Hello. I made this simple command :

pawn Код:
if(strcmp(cmd,"/cashbox",true)==0)
    {
    if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 105)
    {
        MissionActive = 1;
        return 1;
    }
        else
    {
    SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
    }
    return 1;
    }
No errors when compiling, but when I enter in game and tipe /cashbox as admin nothing happens.

And the cashbox mission exists look :
pawn Код:
public OnGameModeMission()
{   if(pdebug == 1){print("[DEBUG] OnGameModeMission()");}

    new string[128];
    if(MissionActive == 1)
    {
        if(PlayerIsDoingMission == INVALID_PLAYER_ID)
        {
            ResetMissions();
            new rcashbox;
            if(city == 1){rcashbox = random(sizeof(RandomFindCashbox_LS));}
            RandomCashboxMissionMoney = MinCashboxMissionMoney+random(MaxCashboxMissionMoney-MinCashboxMissionMoney);
            if(city == 1){format(string, sizeof(string), "** Mission: Cashbox **: Find the cashbox at %s! Worth: %d$", RandomFindCashboxName_LS[rcashbox][0], RandomCashboxMissionMoney);
            SendClientMessageToAll(COLOR_YELLOW, string);
            }
            new Float:ratio = 4.0;
            for(new i=0; i<MAX_SLOTS; i++)
            {
                if(city == 1){SetPlayerCheckpoint(i, RandomFindCashbox_LS[rcashbox][0], RandomFindCashbox_LS[rcashbox][1], RandomFindCashbox_LS[rcashbox][2], ratio);}
            }
            if(city == 1){
            CheckpointBusyX = RandomFindCashbox_LS[rcashbox][0];
            CheckpointBusyY = RandomFindCashbox_LS[rcashbox][1];
            CheckpointBusyZ = RandomFindCashbox_LS[rcashbox][2];
            AllPlaySound(1139);
            }
        }
        }
Reply
#2

I don't see any of your code inside your command calling OnGameModeMission.
Reply
#3

What? I don't understand can you repeat please?
Reply
#4

Where you call OnGameModeMission? With timer or what?
Reply
#5

As varthshenon just said, you are just setting the var to 1 in the command, so you can't expect anything to happen.
You have to call the callback you created (OnGameModeMission()).
If you are calling it with a timer, you have to wait until it gets called.
Reply
#6

Yes, It's called with a timer. here it is
pawn Код:
SetTimer("OnGameModeMission", MISSION_LENGTH, true);
Reply
#7

Where is that?
And how long is MISSION_LENGTH?
Reply
#8

What is PlayerIsDoingMission ?
Reply
#9

@varthshenon - #define MISSION_LENGTH 900000
@PrawkC - new PlayerIsDoingMission = INVALID_PLAYER_ID;
Reply
#10

pawn Код:
if(pdebug == 1){print("[DEBUG] OnGameModeMission()");
Does the string printed?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)