SA-MP Forums Archive
Whats wrong with my cell phone script? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats wrong with my cell phone script? (/showthread.php?tid=90819)



Whats wrong with my cell phone script? - gemadon - 10.08.2009

Код:
dcmd_call(playerid, params[])
{
	if(Phone[playerid] != 1)
	{
	SCM(playerid, COLOR_RED, "You do not have a cell phone!");
	return 1;
	}
	if (player[playerid][calling] || player[playerid][caller] != 255)
 	{
 		SendClientMessage(playerid, 0xBFC0C2FF, "You are already on the phone. use /hangup to hangup");
  	return 1;
  }

 	if (!strlen(params))
  	{
  	SendClientMessage(playerid, 0xBFC0C2FF, "USAGE: /call <phonenumber>");
   	return 1;
  }
  new name[16];
  GetPlayerName(playerid, name, 16);
  new string[41];
  format(string, sizeof(string), "* %s takes out a cellphone.", name);
  ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  new phonenumb = strval(params);
  for(new i = 0; i <= MAX_PLAYERS; i++)
  {
  	if(IsPlayerConnected(i))
   	{
   		if(Number[i] == phonenumb && phonenumb != 0 && player[i][calling] && player[i][caller] == 255 && i != playerid)
    	{
     		format(string, sizeof(string), "Caller ID: %s", name);
      		SendClientMessage(i, 0xFFFF00AA, string);
       	SendClientMessage(i, 0xFFFFFFFF, "Tip: Use /pickup to answer your phone");
       	GetPlayerName(i, name, sizeof(name));
        	format(string, sizeof(string), "You are calling %s...", name);
        SendClientMessage(playerid, 0xFFFFFFAA, string);
        SendClientMessage(i, 0xFFFFFFFF, "TIP: to hangup, type /hangup");
        startphone(playerid);
        player[playerid][calling] = false;
        player[playerid][caller] = i;
        player[i][calling] = false;
        player[i][caller] = playerid;
        return 1;
       }
     }
   }
  return 1;
}
I have a cell phone system scripted into my server and it gives them numbers and all that, but for some reason, my /call command wont connect to any other player, can someone take a look at it and tell me whats wrong?


Re: Whats wrong with my cell phone script? - gemadon - 11.08.2009

*BUMP* Can someone HELP ME OUT??


Re: Whats wrong with my cell phone script? - James_Alex - 11.08.2009

check this
"phonenumb" i got the same probleme as you when i was creating my phone fs
juste try
pawn Код:
new str[128]; format(str, 128, "You tyed %d", phonenumb);
SendClientMessage(playerid, COLOR_YELLOW, str);
and if the message dosen't got the same number as you typed, try to fix the "new phonenumber" ...