Jump to content
  • 0

-Problema comanda /accept taxi-


sk1ZoOr

Question

1 answer to this question

Recommended Posts

  • 0
Acum 44 minute, sk1ZoOr a spus:

Salutare am si eu o problema cu comanda /accept taxi folosesc gm-ul droom, problema este in felul urmator vreau sa fac in asa fel cand un taximetrist accepta o comanda sa ii apara cp cu locatia playerului.

Si o alta problema nici comanda /cancel taxi nu exista .

 

CMD:taxi(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pMember] != 13) return SendClientMessage(playerid, COLOR_GREY, "To call a taxi, use /service taxi.");
        new action[10], id, sendername[30], giveplayer[30], string[128], Float: X, Float: Y, Float: Z;
        if(sscanf(params, "s[10]u", action, id)) return SendClientMessage(playerid, COLOR_GREY, "Syntax:{FFFFFF} /taxi [action] [id]");
        if(strcmp(action,"accept",true) == 0)
        {
            if(TaxiFare[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTGREEN3, "You can't accept a call because you're not on duty.");
            if(TaxiCall[id] == 0) return SendClientMessage(playerid, COLOR_GREY, "This player hasn't called for a taxi, or someone else accepted the call.");
            if(IsPlayerConnected(id))
            {
                GetPlayerName(playerid, sendername, sizeof(sendername));
                GetPlayerName(id, giveplayer, sizeof(giveplayer));
                if(PlayerInfo[id][pLanguage] == 2) format(string, sizeof(string), "Taximetristul %s ti-a acceptat apelul. Asteapta taxiul aici.", sendername);
                else format(string, sizeof(string), "Taxi driver %s has accepted your call. Please wait here for the taxi.", sendername);
                SendClientMessage(id, COLOR_YELLOW, string);
                SS(id, COLOR_WHITE, "Daca nu mai ai nevoie de un taxi, foloseste /cancel taxi.", "If you don't need a taxi anymore, use /cancel taxi.");
                format(string, sizeof(string), "Taxi driver %s has accepted the call from %s. Distance: %.0fm.",sendername,giveplayer,GetDistanceBetweenPlayers(playerid, TaxiCall[id]));
                SendFamilyMessage(13, COLOR_CYAN, string);
                format(string, sizeof(string), "Checkpoint set on %s [%d].", giveplayer, id);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                TaxiAccepted[playerid] = id;
                TaxiCall[id] = 0;
                GetPlayerPos(id, X, Y, Z);
                DisablePlayerCheckpoint(playerid);
                SetPlayerCheckpoint(playerid, X,Y,Z, 3.0);
                UsedFind[playerid] = 1;
                targetfind[playerid] = id;
                return 1;
            }
            else return SendClientMessage(playerid, COLOR_GREY, "Player not connected.");
        }
        else if(strcmp(action,"cancel",true) == 0)
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            SendClientMessage(playerid, COLOR_WHITE, "You have canceled the taxi call!");
            format(string, sizeof(string), "Taxi driver %s canceled your call.", sendername);
            SendClientMessage(TaxiAccepted[playerid], COLOR_YELLOW, string);
            TaxiAccepted[playerid] = -1;
            DisablePlayerCheckpoint(playerid);
            UsedFind[playerid] = 0;
            targetfind[playerid] = -1;
        }
    }
    return 1;
}

 

 

CMD:service(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
    if(IsPlayerConnected(playerid))
    {
        new x_nr[256],string[300],sendername[30],medics,taxidrivers;
        if(sscanf(params, "s[256]",x_nr))
        {
            SendClientMessage(playerid, COLOR_GREY, "Syntax:{FFFFFF} /service [item]");
              SendClientMessage(playerid, COLOR_WHITE, "Available services: medic, taxi");
            return 1;
        }
        if(strcmp(x_nr,"taxi",true) == 0)
        {
            if(PlayerInfo[playerid][pMember] == 13) return SendClientMessage(playerid, COLOR_GREY, "You can't call a taxi because you're a taxi driver!");
            foreach(new i : Player)
            {
                if(TaxiFare > 0) taxidrivers++;
            }
            if(taxidrivers == 0) return SendClientMessage(playerid, COLOR_YELLOW, "There are no taxi drivers on duty at the moment.");
            GetPlayerName(playerid, sendername, sizeof(sendername));
            foreach(new i : Player)
            {
                if(PlayerInfo[pMember] == 13 && TaxiFare > 0)
                {
                    format(string, sizeof(string), "%s [%d] has called for a taxi. Distance: %.0fm.", sendername,playerid,GetDistanceBetweenPlayers(playerid, i));
                    SendClientMessage(i, COLOR_CYAN, string);
                }
            }
            SendClientMessage(playerid, COLOR_GREY, "You have called for a taxi. Please wait here!");
            TaxiCall[playerid] = 1;
            return 1;
        }
    }
    return 1;
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.