11.05.2013, 10:44
Well I got a working phone script but I want it to say when a number does not exist that its not in use.
But when I enter a number it sends that message that many times as that there are players online..
But when I enter a number it sends that message that many times as that there are players online..
pawn Код:
command(call, playerid, params[])
{
new number, string[128];
if(sscanf(params, "d", number))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /call [number]");
}
else
{
if(Player[playerid][PhoneN] == number || Player[playerid][PhoneN] == 0)
{
TextDrawShowForPlayer(playerid, Text:cantcallyourself);
SetTimerEx("RemoveTextMessage", 3500, false, "d", playerid);
}
else
{
if(Player[playerid][PhoneStat] == 0)
{
if(Player[playerid][CellphoneConsole] == -1)
{
if(number == 911)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
Player[playerid][CellphoneConsole] = 911;
format(string, sizeof(string), "* %s takes out %s cellphone, and dials a number.", RPName(playerid), SexGender(playerid));
NearByMessage(playerid, NICESKY, string);
SCM(playerid, PHONECOLOR, "***Dialing sound***");
SendClientMessage(playerid, PHONECOLOR, "Phone: You've called Emergency services, what do you need, Police, Fireman, Medic?");
Player[playerid][OnPhone] = 1;
}
else
{
if(Player[playerid][PhoneCredit] >= 1)
{
if(number != -1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i))
{
if(Player[i][PhoneN] == number)
{
if(Player[i][PhoneStat] == 0)
{
if(Player[i][BeingCalled] == -1)
{
Player[playerid][Calling] = i;
Player[i][BeingCalled] = playerid;
Player[playerid][OnPhone] = 1;
Player[i][OnPhone] = 1;
format(string, sizeof(string), "* %s takes out %s cellphone, and dials a number.", RPName(playerid), SexGender(playerid));
NearByMessage(playerid, NICESKY, string);
SCM(playerid, PHONECOLOR, "***Dialing sound***");
format(string, sizeof(string), "* %s's cellphone starts to ring...", RPName(i));
NearByMessage(i, NICESKY, string);
format(string, sizeof(string), "You are getting called, /pickup, Number: %d", Player[playerid][PhoneN]);
SCM(i, ADMINBLUE, string);
Player[i][CallConnectingTime] = 1;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
}
else
{
format(string, sizeof(string), "* %s takes out %s cellphone, and dials a number.", RPName(playerid), SexGender(playerid));
NearByMessage(playerid, NICESKY, string);
SCM(playerid, PHONECOLOR, "***Dialing sound***");
SCM(playerid, PHONECOLOR, "***You hear a voicemail***");
SCM(playerid, PHONECOLOR, "***BEEP BEEP BEEP***");
format(string, sizeof(string), "* %s puts %s cellphone back into %s pocket.", RPName(playerid), SexGender(playerid), SexGender(playerid));
NearByMessage(playerid, NICESKY, string);
}
}
else
{
format(string, sizeof(string), "* %s takes out %s cellphone, and dials a number.", RPName(playerid), SexGender(playerid));
NearByMessage(playerid, NICESKY, string);
SCM(playerid, PHONECOLOR, "***Dialing sound***");
SCM(playerid, PHONECOLOR, "***You hear a voicemail***");
SCM(playerid, PHONECOLOR, "***BEEP BEEP BEEP***");
format(string, sizeof(string), "* %s puts %s cellphone back into %s pocket.", RPName(playerid), SexGender(playerid), SexGender(playerid));
NearByMessage(playerid, NICESKY, string);
}
}
else if(Player[i][PhoneN] != number) //this is the code
{
format(string, sizeof(string), "* %s takes out %s cellphone, and dials a number.", RPName(playerid), SexGender(playerid));
NearByMessage(playerid, NICESKY, string);
SCM(playerid, PHONECOLOR, "***Dialing sound***");
SCM(playerid, PHONECOLOR, "***You hear a message: This phone number is not in use.***");
SCM(playerid, PHONECOLOR, "***BEEP BEEP BEEP***");
format(string, sizeof(string), "* %s puts %s cellphone back into %s pocket.", RPName(playerid), SexGender(playerid), SexGender(playerid));
NearByMessage(playerid, NICESKY, string);
}
}
}
}
}
else
{
TextDrawShowForPlayer(playerid, Text:Notenoughcredit);
SetTimerEx("RemoveTextMessage", 3500, false, "d", playerid);
}
}
}
else
{
TextDrawShowForPlayer(playerid, Text:AlreadyCalling);
SetTimerEx("RemoveTextMessage", 3500, false, "d", playerid);
}
}
else
{
TextDrawShowForPlayer(playerid, Text:PhoneOFF);
SetTimerEx("RemoveTextMessage", 3500, false, "d", playerid);
}
}
}
return 1;
}