[HELP] Hang up isn't working
#1

Hey guys! Well yesterday I opened my server to a small amount to make sure everything worked well with more than 1 or 2 people on... everything went well apart from when a player was trying to make a phonecall to someone...

/call worked
They could speak to each other

but for /hangup it didn't really work... if the person who MADE the phonecall hungup.. it would work.. but the person who answered it, it didn't exactly work the way it should of done. If the person called hungup. He would put his phone away but after typing a message the call would still be on between the people... it was left to the person who made the call to fix that bug... I CAN'T fix it! Anyone please help? Thanks

Heres my code, it's no doubt wrong.. but why is the question. Thanks
pawn Код:
COMMAND:hangup(playerid, params[])
{
if(PlayerInfo[playerid][Phone] == 0) return SCM(playerid, COLOR_RED, "You do not have a phone!");

for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerOnline(i))
{
if(incall[i] == 1 && incall[playerid] == 1)
{
called[i] = 0;
caller[i] = 0;
incall[i] = 0;
called[playerid] = 0;
caller[playerid] = 0;
incall[playerid] = 0;
SendClientMessage(i, COLOR_YELLOW,"The call has ended");
SetPlayerSpecialAction(incall[i], SPECIAL_ACTION_STOPUSECELLPHONE);
return 1;
}
}
}
return 1;
}
Reply
#2

First of all, indent your code! Second, I think you need to have the playerid of whom the other player is calling stored somewhere, so use that.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
First of all, indent your code! Second, I think you need to have the playerid of whom the other player is calling stored somewhere, so use that.
I normally do indent my code, this is one of the only CMD's that I haven't done so.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)