911 call system
#1

So, I've created this 911 system.. however, after the first "provide your location" it returns the client message as if they said something invalid.

I'm trying to figure out how to use sscanf and its function for it.

Here is some code, not the whole thing though.


Код:
if(number == 911)
	{
	    new location[128], situation[128];
	    if(Mobile[playerid] != 255) return SCM(playerid, COLOR_GREY,"Already in a call");
   		GetPlayerName(playerid,sendername,sizeof(sendername));
   		SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
   		ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
   		{
   		    SendClientMessage(playerid, COLOR_GREEN, "[Emergency Line] {FFFFFF}Hello, I see you are in trouble. Please provide your current location.");
   		    if(!sscanf(params,"s", location)
   		    {
   		        SendClientMessage(playerid, COLOR_GREEN, "[Emergency Line] {FFFFFF} Alright, could you tell me what is going on?");
   		        if(!sscanf(params, "s", situation)
   		        {
   		            SendClientMessage(playerid, COLOR_GREEN, "[Emergency Line] Alright, units are on their way now. Stay put.");
   		            Mobile[playerid] = 255;
   		            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
   		            SendClientMessage(playerid,  COLOR_GREY, "They hung up...");
					CellTime[playerid] = 0;
   		            {
   		                format(string,sizeof(string), "|_______911 Call_______|");
   		                DBroadCast(0x00CCFFFF, string);
   		                format(string,sizeof(string),"Caller: %s    Number: %d", sendername, PlayerInfo[playerid][pNumber]);
   		                DBroadCast(0x00CCFFFF,string);
   		                format(string,sizeof(string),"Location: %s", location);
   		                DBroadCast(0x00CCFFFF,string);
   		                format(string,sizeof(string),"Situation: %s", situation);
   		                DBroadCast(0x00CCFFFF,string);
   		                format(string,sizeof(string),"|_______________________|");
   		                DBroadCast(0x00CCFFFF,string);
					}
				}
			}
		}
	}
	
	return 1;
}
Reply
#2

from
pawn Код:
if(!sscanf(params,"s", location)
to

pawn Код:
if(sscanf(params,"s", location)
And so on...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)