SA-MP Forums Archive
911 call system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 911 call system (/showthread.php?tid=439793)



911 call system - Gecko75 - 26.05.2013

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;
}



Re: 911 call system - Strier - 27.05.2013

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

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