Help with phone listening
#1

I wanna make a command for FBI like /listenphone [name/id] and that command listen his phone..

Код:
if(Mobile[playerid] != 255)
	{
  		new idx;
		tmp = strtok(text, idx);
		GetPlayerName(playerid, sendername, sizeof(sendername));
		format(string, sizeof(string), "%s Says (cellphone): %s", sendername, text);
		ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		//printf("callers line %d called %d caller %d",Mobile[Mobile[playerid]],Mobile[playerid],playerid);
		if(Mobile[playerid] == 914)
		{
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: Sorry I don't understand?");
				return 0;
			}
			new turner[MAX_PLAYER_NAME];
			new wanted[128];
			GetPlayerName(playerid, turner, sizeof(turner));
			SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: We have alerted all units in the area.");
			SendClientMessage(playerid, TEAM_CYAN_COLOR, "Thank you for reporting this incident");
			format(wanted, sizeof(wanted), "Dispatch: All Units IA: Caller: %s",turner);
			SendTeamBeepMessage(1, TEAM_CYAN_COLOR, wanted);
			format(wanted, sizeof(wanted), "Dispatch: Incident: %s",text);
			SendTeamMessage(1, TEAM_CYAN_COLOR, wanted);
			SendClientMessage(playerid, COLOR_GRAD2, "   They Hung Up...");
			Mobile[playerid] = 255;
			return 0;
		}
		if(Mobile[playerid] == 913)
		{
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand?");
				return 0;
			}
			if ((strcmp("no", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("no")))
			{
				new turner[MAX_PLAYER_NAME];
				new wanted[128];
				GetPlayerName(playerid, turner, sizeof(turner));
				SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: We have alerted all units in the area.");
				SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
				format(wanted, sizeof(wanted), "HQ: All Units APB: Reporter: %s",turner);
				SendFamilyMessage(1, COLOR_DBLUE, wanted);
				format(wanted, sizeof(wanted), "HQ: Crime: %s, Suspect: Unknown",PlayerCrime[playerid][pAccusing]);
				SendFamilyMessage(1, COLOR_DBLUE, wanted);
				SendClientMessage(playerid, COLOR_GRAD2, "   They Hung Up...");
				Mobile[playerid] = 255;
				return 0;
			}
			new badguy;
			//badguy = strval(tmp);
			badguy = ReturnUser(tmp);
			if (IsPlayerConnected(badguy))
			{
			    if(badguy != INVALID_PLAYER_ID)
			    {
					if (gTeam[badguy] == 2 || gTeam[badguy] == 1)
					{
						SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: You will have to contact internal affairs. This is an emergency line");
						SendClientMessage(playerid, COLOR_GRAD2, "   They Hung Up...");
						Mobile[playerid] = 255;
						return 0;
					}
					if (WantedPoints[badguy] > 0)
					{
						SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: Units are already assigned to that case");
						SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
						SendClientMessage(playerid, COLOR_GRAD2, "   They Hung Up...");
						Mobile[playerid] = 255;
						return 0;
					}
					if (badguy == playerid)
					{
						SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: Dont Fool Around, This is an emergency line.");
						SendClientMessage(playerid, COLOR_GRAD2, "   They Hung Up...");
						Mobile[playerid] = 255;
						return 0;
					}
					SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: We have alerted all units in the area.");
					SendClientMessage(playerid, COLOR_DBLUE, "Thank you for reporting this crime");
					SetPlayerCriminal(badguy,playerid, PlayerCrime[playerid][pAccusing]);
					if(WantedPoints[badguy] > 0) { } else { WantedPoints[badguy] += 2; }
					SendClientMessage(playerid, COLOR_GRAD2, "   They Hung Up...");
					Mobile[playerid] = 255;
					return 0;
				}//invalid id
				return 0;
			}//not connected
			else
			{
				format(string, sizeof(string), "Police HQ: I have no Information on %s, are you sure thats the right name?",tmp);
				SendClientMessage(playerid, COLOR_DBLUE, string);
				return 0;
			}
		}
		if(Mobile[playerid] == 912)
		{
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand?");
				return 0;
			}
			strmid(PlayerCrime[playerid][pAccusing], text, 0, strlen(text), 255);
			SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: If you know the assailant's name or part of it say it now or just say no.");
			Mobile[playerid] = 913;
			return 0;
		}
		if(Mobile[playerid] == 911)
		{
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand, police or paramedic?");
				return 0;
			}
			else if ((strcmp("police", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("police")))
			{
				SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: I am patching you to  Police HQ, please hold.");
				Mobile[playerid] = 912;
				SendClientMessage(playerid, COLOR_DBLUE, "Police HQ: Please give me a short description of the crime.");
				return 0;
			}
			else if ((strcmp("paramedic", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("paramedic")))
			{
				SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: I am patching you to  Paramedic HQ, please hold.");
				Mobile[playerid] = 914;
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "Dispatch: Please give me a short description of the Incident.");
				return 0;
			}
			else
			{
				SendClientMessage(playerid, COLOR_ALLDEPT, "EMERGENCY: Sorry i dont understand, police or paramedic?");
				return 0;
			}
		}
		if(IsPlayerConnected(Mobile[playerid]))
		{
		    if(Mobile[Mobile[playerid]] == playerid)
		    {
				SendClientMessage(Mobile[playerid], COLOR_YELLOW,string);
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_YELLOW,"Theres nobody there");
		}
		return 0;
	}
I tried but it doesn't works
Reply
#2

I don't see anything that would do the trick you want in your code.
Perhaps I missed it, tell me which line it is.
Reply
#3

Just format the string again and send it to admins if thats what your trying to do an example of a string in your script

format(string, sizeof(string), "%s Says (cellphone): %s", sendername, text);
SendClientMessage(anewadminvariable, colour, string);

or explain in more detail
Reply
#4

Nice GF edit -.- but I know what you wanna do, it'd be something like, having an array for the FBI command, so have:

Код:
new IsFBIListening[MAX_PLAYER_NAME];
Код:
Tog on: IsFBIListening[playerid] = 1;
Tog off: IsFBIListening[playerid] = 0;
Then, somewhere in your phone script, put this: (download foreach include)
pawn Код:
foreach(Player, i)
{
    if(PlayerInfo[playerid][pMember] == 2 && IsFBIListening[playerid] == 1]
     {
       //send the string
     }
}
Maybe that's what you want.
Reply
#5

He must save the FBI player's id to variable, not on/off.
Reply
#6

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
He must save the FBI player's id to variable, not on/off.
yeah, so the whole command would be like so:
pawn Код:
if(strmp(cmdtext, "/fbilisten")
{
    if(PlayerInfo[playerid][pMember] != 2)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "You're not FBI!");
        return 1;
    }
    if(IsFBIListening[playerid] == 1) //off
    {
        IsFBIListening[playerid] = 0;
        return 1;
    }
    if(IsFBIListening[playerid] == 0) //on
    {
        IsFBIListening[playerid] = 1;
        return 1;
    }
    return 1;
}
Reply
#7

What I mean is:
pawn Код:
new Jacked[MAX_PLAYERS];

Jacked[playerid] = 0;//OnPlayerConnect

if(Jacked[playerid] != 0)//OnPlayerText
{
    SendClientMessage(Jacked[playerid],color,text);
}

CMD:fbilisten(playerid,params[])
{
    if(PlayerInfo[playerid][pMember] != 2) return SendClientMessage(playerid, COLOR_LIGHTRED, "You're not FBI!");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTRED, "/fbilisten <id>");
    //Use IsNumeric or sscanf
    if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, COLOR_LIGHTRED, "blahblahblah");
    Jacked[strval(params)] = playerid;
    return 1;
}
Reply
#8

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
What I mean is:
pawn Код:
new Jacked[MAX_PLAYERS];

Jacked[playerid] = 0;//OnPlayerConnect

if(Jacked[playerid] != 0)//OnPlayerText
{
    SendClientMessage(Jacked[playerid],color,text);
}

CMD:fbilisten(playerid,params[])
{
    if(PlayerInfo[playerid][pMember] != 2) return SendClientMessage(playerid, COLOR_LIGHTRED, "You're not FBI!");
    if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTRED, "/fbilisten <id>");
    //Use IsNumeric or sscanf
    if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid, COLOR_LIGHTRED, "blahblahblah");
    Jacked[strval(params)] = playerid;
    return 1;
}
now if i type a command i get "unknown command"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)