Cellphone bug
#1

Hello, when someone call me and i /pickup i normally answer then to close the call i type /hangup but if the other player hangup i still get [Cellphone] (name)text) instead of (name)text) here is the code:

pawn Код:
CMD:pickup(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pHasCellphone]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a cellphone.");
    if(!BeingCalled[playerid]) return SendClientMessage(playerid, COLOR_GREY, "Nobody is calling you.");
    format(string, sizeof(string), "* %s answers their cellphone.", RPN(playerid));
    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    SendClientMessage(playerid, COLOR_ORANGE, " You have picked up the line.");
    SendClientMessage(Caller[playerid], COLOR_ORANGE, " They pickedup the line.");
    Calling[Caller[playerid]] = 2;
    BeingCalled[playerid] = 2;
    SetTimerEx("PhoneCall", 1000, false, "d", Caller[playerid]);
    return 1;
}
pawn Код:
CMD:hangup(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pHasCellphone]) return SendClientMessage(playerid, COLOR_GREY, "You don't own a cellphone.");
    if(!BeingCalled[playerid] && !Calling[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on a call nor is anybody calling you.");
    format(string, sizeof(string), "* %s puts their cellphone away.", RPN(playerid));
    SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
    SendClientMessage(playerid, COLOR_ORANGE, " You have hungup the line.");
    if(BeingCalled[playerid]) SendClientMessage(Caller[playerid], COLOR_ORANGE, " They hungup the line.");
    else if(Calling[playerid]) SendClientMessage(Called[playerid], COLOR_ORANGE, " They hungup the line.");
    if(Call911[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You can't hangup on a 911 call.");
    //
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
    if(Calling[playerid])
    {
        SetPlayerSpecialAction(Called[playerid], SPECIAL_ACTION_STOPUSECELLPHONE);
        format(string, sizeof(string), "[Cellphone] Phonecall lasted for %d seconds, price: $%d", CallTime[playerid], CallTime[playerid]*10/100);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        GiveZaiatMoney(playerid, -(CallTime[playerid]*10/100));
        TaxMoney += (CallTime[playerid]*10/100);
        Calling[playerid] = 0;
        BeingCalled[playerid] = 0;
        Caller[playerid] = -1;
        CallTime[playerid] = 0;
        Called[playerid] = -1;
    }
    else if(Calling[Caller[playerid]])
    {
        SetPlayerSpecialAction(Called[playerid], SPECIAL_ACTION_STOPUSECELLPHONE);
        format(string, sizeof(string), "[Cellphone] Phonecall lasted for %d seconds, price: $%d", CallTime[Caller[playerid]], CallTime[Caller[playerid]]*10/100);
        SendClientMessage(Caller[playerid], COLOR_YELLOW, string);
        GiveZaiatMoney(Caller[playerid], -(CallTime[Caller[playerid]]*10/100));
        TaxMoney += (CallTime[Caller[playerid]]*10/100);
        Calling[Called[playerid]] = 0;
        BeingCalled[Called[playerid]] = 0;
        Caller[Called[playerid]] = -1;
        CallTime[Called[playerid]] = 0;
        Called[Called[playerid]] = -1;
    }
    return 1;
}
pawn Код:
// Normal Calling
    if(BeingCalled[playerid] == 2 || Calling[playerid] == 2 || Call911[playerid])
    {
        if(strlen(PlayerInfo[playerid][pAccent])) format(string, sizeof(string), "[Cellphone] %s: [%s Accent] %s", RPN(playerid), PlayerInfo[playerid][pAccent], text);
        else format(string, sizeof(string), "[Cellphone] %s: %s", RPN(playerid), text);
        if(!Call911[playerid])
        {
            if(BeingCalled[playerid] == 2) SendClientMessage(Caller[playerid], COLOR_YELLOW, string);
            else if(Calling[playerid] == 2) SendClientMessage(Called[playerid], COLOR_YELLOW, string);
        }
    }
Reply


Messages In This Thread
Cellphone bug - by Fiore - 01.01.2013, 21:10
Re: Cellphone bug - by IPrototypeI - 01.01.2013, 21:15
Re: Cellphone bug - by Fiore - 01.01.2013, 21:37
Re: Cellphone bug - by Infinity90 - 01.01.2013, 21:41
Re: Cellphone bug - by Fiore - 01.01.2013, 22:13
Re: Cellphone bug - by Fiore - 02.01.2013, 06:17
Re: Cellphone bug - by Fiore - 10.01.2013, 08:34

Forum Jump:


Users browsing this thread: 1 Guest(s)