Won't create a player marker or put phone away.
#1

pawn Код:
if(number == 111)
    {
        format(string, sizeof(string), "* %s takes out their cellphone, pressing a few numbers *", GetNameEx(playerid));
        ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
        SetPlayerAttachedObject(playerid, 0, 330 , 6);
        BeingCalled[playerid] = 1;
        SendClientMessage(playerid, COLOUR_GREY, "Connecting......");
        new am;
        foreach(Player, i)
        {
            if(TaxiDuty[i] == 1)
            {
                am ++;
            }
        }
        if(am == 0)
        {
            SendClientMessage(playerid, COLOUR_WHITE, "'I'm really sorry, there are no taxis available at the moment.'");
            BeingCalled[playerid] = -1;
            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
            RemovePlayerAttachedObject(playerid, 0);
            ClearAnimations(playerid);
        }
        if(am > 0)
        {
            SendClientMessage(playerid, COLOUR_YELLOW, "'A taxi has been dispatched to your location, thank you for calling!'");
            BeingCalled[playerid] = -1;
            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
            RemovePlayerAttachedObject(playerid, 0);
            ClearAnimations(playerid);
            foreach(Player, i)
            {
                if(TaxiDuty[i] == 1)
                {
                new zone[MAX_ZONE_NAME];
                    GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME);
                    format(string, sizeof(string), "%s is requesting a taxi at %s, please make your way to                  their location.", GetNameEx(playerid), zone);
                SendClientMessage(i, COLOUR_YELLOW, string);
                    SetPlayerMarkerForPlayer(playerid, i, COLOUR_YELLOW);
                }
               }
        }
    }
It delivers the client message but doesn't set the player marker for the player, it also doesn't stop the cellphone being shown, it gets the correct location.
Reply
#2

I assume SetPlayerMarkerForPlayer needs the player markers to be active to work. If you don't have them, then it's probably not going to anything. I guess what you need is a checkpoint at your callers location.
More info here: https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint
Reply
#3

I've already done that.
Reply
#4

You have the parameters in the wrong order. SetPlayerMarkerForPlayer is kind of confusing, but refer to the wiki for explanation.

Some smaller improvements: get the player's zone and format it the message before the loop starts instead of within. The message is going to be the same for everyone that receives it so it makes no sense doing it over and over again. Also create a function "StopUsingCellphone" or something. I imagine you have these exact four lines:
PHP код:
BeingCalled[playerid] = -1;
SetPlayerSpecialAction(playeridSPECIAL_ACTION_STOPUSECELLPHONE);
RemovePlayerAttachedObject(playerid0);
ClearAnimations(playerid); 
All over the place. Move them to a function to clean up the code.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)