Hospital(Death) and cellphone problem.
#1

So, i downloaded iGetty's Virtual Roleplay. (I can't contact iGetty as he's not active or anything).

When a player dies, he ends up at hospital. But when he's out of the hospital, and tries to speak in the normal chat, it says: ''That player isn't connected''. I have a huge issue with this, because i don't want my players to relog every time they die.


Second problem:

When a player tries to call another player, it says: ''That cellphone cannot be contacted''. But the other cellphone is ringing! When the OTHER player answers the phone, nothing happens, and it's no cellphone call. They talk normal and everything, it's not working. I simply need some HUGE help here.
Reply
#2

The cellphone codes..:

Код:
command(call, playerid, params[])
{
	if(Player[playerid][CellPhone] == 1)
	{
	    if(Player[playerid][CellPhoneStatus] == 0) return SendClientMessage(playerid, WHITE, "Your cell-phone is turned off.");
	    if(Player[playerid][CellBattery] == 0) return SendClientMessage(playerid, WHITE, "Your Cell Phone has no battery.");
	    new number, string[256];
	    if(OnPhone[playerid] == 1) return SendClientMessage(playerid, GREY, "You are already on a call. Use /h(angup) to end it.");
	    if(sscanf(params, "d", number)) return SendClientMessage(playerid, WHITE, "Server: /call [number]");
	    {
			if(Player[playerid][CellPhoneNumber] == number) return SendClientMessage(playerid, GREY, "That phone is either turned off or yours.");
			if(number != -1 || number != 0)
			{
	        	if(number == 911)
		        {
		            format(string, sizeof(string), "Operator: Hello, you have reached the emergency services.");
		            SendClientMessage(playerid, WHITE, string);
		            format(string, sizeof(string), "For Police, please press 1. For Medical/Fire, please press 2.");
		            SendClientMessage(playerid, WHITE, string);
		            OnPhone[playerid] = 1;
					NumberCalled[playerid] = 911;
					SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
				}
				else
				{
					for(new i = 0; i < MAX_PLAYERS; i++)
					{
					    if(IsPlayerConnected(i))
					    {
					        if(Player[i][CellPhoneNumber] == number)
					        {
					            Calling[playerid] = i;
								Calling[i] = playerid;
								format(string, sizeof(string), "* %s takes out a cellphone and dials some numbers... *", MaskOnOff(playerid));
								CloseMessage(playerid, ACTION, string);
								format(string, sizeof(string), "* %s's cellphone starts to ring... *", MaskOnOff(i));
								CloseMessage(i, ACTION, string);
								SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
								Player[playerid][Money] -= 5;
								OnPhone[playerid] = 1;
								NumberCalled[playerid] = number;
								GameTextForPlayer(playerid, "Call connected -$5", 3000, 5);
							}
							else
							{
								SendClientMessage(playerid, GREY, "Operator: That cell-phone can't be contacted.");
								Calling[playerid] = -1;
								OnPhone[playerid] = 0;
								NumberCalled[playerid] = -1;
							}
						}
					}
				}
			}
			else return SendClientMessage(playerid, GREY, "That number isn't valid.");
		}
	}
	else return SendClientMessage(playerid,WHITE, "You don't have a Cell-Phone.");
	return 1;
}

command(pickup, playerid, params[])
{
	if(Player[playerid][CellPhone] == 1)
	{
	    if(OnPhone[playerid] == 0)
	    {
	        if(Calling[playerid] != -1)
	        {
	            new string[68];
	            format(string, sizeof(string), "* You have picked up your cell-phone.");
	            SendClientMessage(playerid, GREY, string);
	            format(string, sizeof(string), "* %s has picked up their cell-phone. *", MaskOnOff(playerid));
				CloseMessage(playerid, ACTION, string);
				format(string, sizeof(string), "%s picks up the call.", MaskOnOff(playerid));
				SendClientMessage(Calling[playerid], GREY, string);
				SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
			}
			else return SendClientMessage(playerid, WHITE, "You aren't being called.");
		}
		else return SendClientMessage(playerid, WHITE, "You are already on a call.");
	}
	else return SendClientMessage(playerid, WHITE, "You don't have a cell-phone.");
	return 1;
}

command(p, playerid, params[])
{
	return cmd_pickup(playerid, params);
}
and here, the hospital codes:

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	new string[512];
	Hospitalized[playerid] = 1;
	SendClientMessage(playerid, WHITE, " ");
	format(string, sizeof(string), "{CC0000}Hospital Staff:{FFFFFF} Hello there %s, you have been sent to hospital and are undergoing our treatment.", GetPlayerFirstName(playerid));
	SendClientMessage(playerid, WHITE, string);
	SendClientMessage(playerid, WHITE, "{CC0000}Hospital Staff:{FFFFFF} We have checked you over and we figured out that you are going to have to spend some time in here with us.");
	SendClientMessage(playerid, WHITE, "{CC0000}Hospital Staff:{FFFFFF} There's no need to worry, you are under professional and complete care with our services.");
	SendClientMessage(playerid, WHITE, "{CC0000}Hospital Staff:{FFFFFF} Is there anybody that you would like to call for you? (( Use full name including '_' and type it in chat. ))");
    SendClientMessage(playerid, WHITE, " ");
    TogglePlayerSpectating(playerid, false);
	TogglePlayerSpectating(playerid, true);
	TogglePlayerControllable(playerid, 0);
	SetPlayerPos(playerid, 1237.1611,304.9076,24.7578);
	SetPlayerCameraPos(playerid, 1251.0834,353.5869,26.5555);
	SetPlayerCameraLookAt(playerid, 1247.0811,325.1535,24.7578);
	SetTimerEx("HospitalRelease", 30000, 0, "i", playerid);
	SetPlayerPos(playerid, 1237.1611,304.9076,24.7578);
	SetPlayerCameraPos(playerid, 1251.0834,353.5869,26.5555);
	SetPlayerCameraLookAt(playerid, 1247.0811,325.1535,24.7578);
	SetPlayerHealth(playerid, 100);
	SetPlayerArmour(playerid, 0);
	Player[playerid][Health] = 100;
	Player[playerid][Armour] = 0;
	SetTimerEx("HosCam", 1000, 0, "i", playerid);
 	return 1;
}

public HosCam(playerid)
{
    SetPlayerPos(playerid, 1237.1611,304.9076,24.7578);
	SetPlayerCameraPos(playerid, 1251.0834,353.5869,26.5555);
	SetPlayerCameraLookAt(playerid, 1247.0811,325.1535,24.7578);
	return 1;
}

public RandomTextSend()
{
	SendClientMessageToAll(0xC0C400, RandomText[random(sizeof(RandomText))]);
}

public OnPlayerDisconnect(playerid, reason)
{
	if(Logged[playerid] == 1)
	{
	    new string[256];
	    switch(reason)
	    {
	        case 0: format(string, sizeof string, "%s has left the server. (Lost Connection)", RemoveUnderScore(playerid));
	        case 1: format(string, sizeof string, "%s has left the server. (Leaving)", RemoveUnderScore(playerid));
	        case 2: format(string, sizeof string, "%s has left the server. (Kicked/Banned)", RemoveUnderScore(playerid));
	    }
	    CloseMessage(playerid, GREY, string);
	    SendToAdmins(GREY, string, 0);
	    SendToAdmins(GREY, string, 1);
		SaveStats(playerid);
		KillTimer(PlayerStats[playerid]);
		KillTimer(DrugTimer[playerid]);
		KillTimer(MinuteTimer[playerid]);
		TextDrawHideForPlayer(playerid, Speedometer[playerid]);
		TextDrawHideForPlayer(playerid, Clock);
		KillTimer(PickupsTimer[playerid]);
		KillTimer(SpeedoTimer[playerid]);
		KillTimer(PhoneBatteryTimer[playerid]);
		KillTimer(WaitingTimer[playerid]);
		KillTimer(ArrestTimer[playerid]);
		KillTimer(AJailTimer[playerid]);
		KillTimer(FuelTimer[playerid]);
		OnQuiz[playerid] = 0;
		QuizRight[playerid] = 0;
		VehicleSell[playerid] = -1;
		ClickStop[playerid] = 0;
		HouseSell[playerid] = -1;
		MethSell[playerid] = -1;
		Fishing[playerid] = 0;
		CocaineSell[playerid] = -1;
		CocaineSellPrice[playerid] = -1;
		CocaineSellAmount[playerid] = -1;
		MethSellPrice[playerid] = -1;
		MethSellAmount[playerid] = -1;
		WeedSell[playerid] = -1;
		WeedSellPrice[playerid] = -1;
		TextDrawHideForPlayer(playerid, JoinText);
		WeedSellAmount[playerid] = -1;
		HouseSellPrice[playerid] = -1;
		VehicleSellPrice[playerid] = -1;
		KillTimer(NewbieTimer[playerid]);
	    for(new i=0;i<47;i++) Weapon[playerid][i] = false;
		
		if(NewsStartedBy == playerid)
		{
			SendClientMessageToAll(RED, "The news reporter has left the game. Use /stopwatchnews to continue game-play.");
			NewsOn = 0;
		}
	}
	return 1;
}

#define Holding(%0) \
	((newkeys & (%0)) == (%0))
Reply
#3

bump
Reply
#4

HELP then
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)