Jump to content
  • 0

-Problema comanda /accept taxi-


Question

Posted

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 .

 

1 answer to this question

Recommended Posts

  • 0
Posted
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;
}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.