Unknown command problem?
#1

pawn Код:
CMD:hangup(playerid)
{
    new iCaller = GetPVarInt(playerid, "_onCall"), Float: iCallingCost = iCallCost[iCaller];
    if(PlayerData[playerid][p_Phone][0] != 0)
    {
        if(PlayerData[playerid][p_Number] != 0)
        {
            if(GetPVarInt(playerid, "_onCall") != INVALID_PLAYER_ID)
            {
                GameTextForPlayer(playerid, "~b~DISCONNECTED!", 1500, 4);
                GameTextForPlayer(iCaller, "~b~DISCONNECTED!", 1500, 4);
                format(szOutput, sizeof(szOutput), "INFO: The call cost to %s came to $%d, it was taken from your phone credit.", GetPlayerNameEx(playerid), iCallingCost);
                SendClientMessage(iCaller, COLOR_WHITE, szOutput);
                PlayerData[iCaller][p_PhoneCredit] -= iCallingCost;
               
                iCallCost[iCaller] = 0;
                SetPVarInt(iCaller, "_onCall", -1);
                SetPVarInt(iCaller, "_callRinger", 0);
                SetPVarInt(playerid, "_onCall", -1);
            }
            else if(GetPVarInt(playerid, "_onCall") == -1) SendClientMessage(playerid, COLOR_GREY, "{D10D0D}[ERROR]: {FFFFFF}You are not currently on a call!");
        }
        else SendClientMessage(playerid, COLOR_GREY, "{D10D0D}[ERROR]: {FFFFFF}You do not have a simcard in your mobile phone!");
    }
    else SendClientMessage(playerid, COLOR_GREY, "{D10D0D}[ERROR]: {FFFFFF}You do not own a mobile phone!");
    return 1;
}
Okay, this is my hangup command. It work's fine when you are on the phone to somebody and wish to hangup, but if you use the command when you are not on the phone it says "Unknown Command.".

I really don't know why, any ideas?
Reply
#2

I would say adding here 'reutrn 1', but not sure if it will make a change..
pawn Код:
if(GetPVarInt(playerid, "_onCall") != INVALID_PLAYER_ID)
            {
                GameTextForPlayer(playerid, "~b~DISCONNECTED!", 1500, 4);
                GameTextForPlayer(iCaller, "~b~DISCONNECTED!", 1500, 4);
                format(szOutput, sizeof(szOutput), "INFO: The call cost to %s came to $%d, it was taken from your phone credit.", GetPlayerNameEx(playerid), iCallingCost);
                SendClientMessage(iCaller, COLOR_WHITE, szOutput);
                PlayerData[iCaller][p_PhoneCredit] -= iCallingCost;
               
                iCallCost[iCaller] = 0;
                SetPVarInt(iCaller, "_onCall", -1);
                SetPVarInt(iCaller, "_callRinger", 0);
                SetPVarInt(playerid, "_onCall", -1);
            }
Reply
#3

I tried that, didn't help. :/
Reply
#4

Show the callback for cmd received and performed
Reply
#5

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) SendClientMessage(playerid, COLOR_WHITE, "{D10D0D}[ERROR]: {FFFFFF}The command you entered was not found in the server! (/help)");
    return 1;
}
Reply
#6

Anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)