Unknown command problem? -
MattSlater - 03.04.2013
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?
Re: Unknown command problem? -
zxc1 - 03.04.2013
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);
}
Re: Unknown command problem? -
MattSlater - 03.04.2013
I tried that, didn't help. :/
Re: Unknown command problem? -
iJumbo - 03.04.2013
Show the callback for cmd received and performed
Re: Unknown command problem? -
MattSlater - 06.04.2013
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;
}
Re: Unknown command problem? -
MattSlater - 08.04.2013
Anyone?