03.04.2013, 17:32
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;
}
I really don't know why, any ideas?