Jump to content
  • 0

/heal crash ...


qUick

Question

Cand intru in armory si scriu /heal se inchide serveru :|

//-----------------------------------[HEAL]-------------------------------------------------------------------------
	if(strcmp(cmd, "/heal", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			tmp = strtok(cmdtext, idx);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new location = PlayerInfo[playerid][pLocal];
			if(!strlen(tmp))
			{
				if(location != 255)
				{
					if(location < 99)
					{
						if(HouseInfo[location][hArm] == 1 && IsACop(playerid))
						{
							format(string, sizeof(string), "* %s puts on body armour.", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							TogglePlayerControllable(playerid, 0);
							GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
							Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
							Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
							SetPlayerPos(playerid,1527.5,-12.1,1002.0);
							PlayerInfo[playerid][pLocal] = 255;
							SetPlayerInterior(playerid,99);
							Spectate[playerid] = 257;
						}
						else
						{
							format(string, sizeof(string), "This place does not have armour upgrades.");
							SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
						}
						if(HouseInfo[location][hHel] == 1)
						{
							new Float:tempheal;
							GetPlayerHealth(playerid,tempheal);
							if ( tempheal < 100.0)
							{
								SetPlayerHealth(playerid,100.0);
								PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
								format(string, sizeof(string), "You have been healed to 100 health.");
								SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
							}
							else
							{
								SendClientMessage(playerid, TEAM_GREEN_COLOR,"You are already healed to 100.");
							}
						}
						else
						{
							format(string, sizeof(string), "This place does not have healing upgrades.");
							SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
						}
						return 1;
					}
					else if(location == 101)//Restaurant
					{
					    new Float:tempheal;
						GetPlayerHealth(playerid,tempheal);
						if ( tempheal < 100.0)
						{
							SetPlayerHealth(playerid,100.0);
							PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
							format(string, sizeof(string), "You have been healed to 100 health.");
							SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
						}
						else
						{
							SendClientMessage(playerid, TEAM_GREEN_COLOR,"You are already healed to 100.");
						}
					}
					else if(location == 102 && IsACop(playerid))//Police Armoury
					{
					    SetPlayerHealth(playerid,100.0);
					    format(string, sizeof(string), "* %s puts on body armour.", sendername);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						TogglePlayerControllable(playerid, 0);
						GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
						Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
						Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
						SetPlayerPos(playerid,1527.5,-12.1,1002.0);
						PlayerInfo[playerid][pLocal] = 255;
						SetPlayerInterior(playerid,99);
						Spectate[playerid] = 257;
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /heal [playerid/PartOfName] [price]");
					return 1;
				}
			}
			giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
			    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /heal [playerid/PartOfName] [price]");
				return 1;
			}
			moneys = strval(tmp);
			if(moneys < 1 || moneys > 1000) { SendClientMessage(playerid, COLOR_GREY, "   Healing price not below 1 or above 1000 !"); return 1; }
			if (giveplayerid == playerid)
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You can not heal yourself!");
				return 1;
			}
			if (IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					new giveambu = GetPlayerVehicleID(giveplayerid);
					new playambu = GetPlayerVehicleID(playerid);
					if(gTeam[playerid] == TEAM_CYAN||PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4)//model
					{
						if (IsAnAmbulance(playambu) && playambu == giveambu)
						{
							new Float:tempheal;
							GetPlayerHealth(giveplayerid,tempheal);
							if(tempheal >= 100.0)
							{
								SendClientMessage(playerid, TEAM_GREEN_COLOR,"   That person is fully healed.");
								return 1;
							}
							format(string, sizeof(string), "~y~You healed ~n~~w~%s~n~~g~$%d", giveplayer,moneys);
							GameTextForPlayer(playerid, string, 5000, 1);
							GivePlayerMoney(playerid,moneys);
							GivePlayerMoney(giveplayerid,-moneys);
							new hp = 0;
						    if(PlayerInfo[playerid][pPainPerk] > 0)
						    {
						        hp = 20 * PlayerInfo[playerid][pPainPerk]; hp += 100;
								SetPlayerHealth(giveplayerid, hp);
						    }
						    else
						    {
						        hp = 100;
						        SetPlayerHealth(giveplayerid, 100);
						    }
							PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
							PlayerPlaySound(giveplayerid, 1150, 0.0, 0.0, 0.0);
							format(string, sizeof(string), "You have been healed to %d health -$%d",hp,moneys);
							SendClientMessage(giveplayerid, TEAM_GREEN_COLOR,string);
							if(STDPlayer[giveplayerid] > 0)
				            {
								STDPlayer[giveplayerid] = 0;
								SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* You are no longer infected with a STD anymore because of the Medics help !");
							}
						}
						else
						{
							SendClientMessage(playerid, COLOR_GRAD1, "   One of you is not in the Ambulance / Chopper !");
							return 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
						return 1;
					}
				}
			}
			else
			{
				format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Crash info:
[16:37:40] Crash caused by gamemodes\gf.amx, see stack trace below
[16:37:40] Stack trace (most recent call first):
[16:37:40]   SendClientMessage (native) on line 1 in \pawno\include\float.inc
[16:37:40]   operator-(Float:) (entry point)

float.inc este cel default, nu e nimic modificat la el :|

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

incearca asa:

new Float:health;

//-----------------------------------[HEAL]-------------------------------------------------------------------------
	if(strcmp(cmd, "/heal", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			tmp = strtok(cmdtext, idx);
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new location = PlayerInfo[playerid][pLocal];
			if(!strlen(tmp))
			{
				if(location != 255)
				{
					if(location < 99)
					{
						if(HouseInfo[location][hArm] == 1 && IsACop(playerid))
						{
							format(string, sizeof(string), "* %s puts on body armour.", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							TogglePlayerControllable(playerid, 0);
							GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
							Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
							Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
							SetPlayerPos(playerid,1527.5,-12.1,1002.0);
							PlayerInfo[playerid][pLocal] = 255;
							SetPlayerInterior(playerid,99);
							Spectate[playerid] = 257;
						}
						else
						{
							format(string, sizeof(string), "This place does not have armour upgrades.");
							SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
						}
						if(HouseInfo[location][hHel] == 1)
						{
							GetPlayerHealth(playerid,health);
							if ( health < 100.0)
							{
								SetPlayerHealth(playerid,100.0);
								PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
								format(string, sizeof(string), "You have been healed to 100 health.");
								SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
							}
							else
							{
								SendClientMessage(playerid, TEAM_GREEN_COLOR,"You are already healed to 100.");
							}
						}
						else
						{
							format(string, sizeof(string), "This place does not have healing upgrades.");
							SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
						}
						return 1;
					}
					else if(location == 101)//Restaurant
					{
					    
						GetPlayerHealth(playerid,health);
						if ( health < 100.0)
						{
							SetPlayerHealth(playerid,100.0);
							PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
							format(string, sizeof(string), "You have been healed to 100 health.");
							SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
						}
						else
						{
							SendClientMessage(playerid, TEAM_GREEN_COLOR,"You are already healed to 100.");
						}
					}
					else if(location == 102 && IsACop(playerid))//Police Armoury
					{
					    SetPlayerHealth(playerid,100.0);
					    format(string, sizeof(string), "* %s puts on body armour.", sendername);
						ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						TogglePlayerControllable(playerid, 0);
						GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
						Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
						Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
						SetPlayerPos(playerid,1527.5,-12.1,1002.0);
						PlayerInfo[playerid][pLocal] = 255;
						SetPlayerInterior(playerid,99);
						Spectate[playerid] = 257;
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /heal [playerid/PartOfName] [price]");
					return 1;
				}
			}
			giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
			    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /heal [playerid/PartOfName] [price]");
				return 1;
			}
			moneys = strval(tmp);
			if(moneys < 1 || moneys > 1000) { SendClientMessage(playerid, COLOR_GREY, "   Healing price not below 1 or above 1000 !"); return 1; }
			if (giveplayerid == playerid)
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You can not heal yourself!");
				return 1;
			}
			if (IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
					GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					new giveambu = GetPlayerVehicleID(giveplayerid);
					new playambu = GetPlayerVehicleID(playerid);
					if(gTeam[playerid] == TEAM_CYAN||PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4)//model
					{
						if (IsAnAmbulance(playambu) && playambu == giveambu)
						{

							GetPlayerHealth(giveplayerid,health);
							if(health >= 100.0)
							{
								SendClientMessage(playerid, TEAM_GREEN_COLOR,"   That person is fully healed.");
								return 1;
							}
							format(string, sizeof(string), "~y~You healed ~n~~w~%s~n~~g~$%d", giveplayer,moneys);
							GameTextForPlayer(playerid, string, 5000, 1);
							GivePlayerMoney(playerid,moneys);
							GivePlayerMoney(giveplayerid,-moneys);
							new hp = 0;
						    if(PlayerInfo[playerid][pPainPerk] > 0)
						    {
						        hp = 20 * PlayerInfo[playerid][pPainPerk]; hp += 100;
								SetPlayerHealth(giveplayerid, hp);
						    }
						    else
						    {
						        hp = 100;
						        SetPlayerHealth(giveplayerid, 100);
						    }
							PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
							PlayerPlaySound(giveplayerid, 1150, 0.0, 0.0, 0.0);
							format(string, sizeof(string), "You have been healed to %d health -$%d",hp,moneys);
							SendClientMessage(giveplayerid, TEAM_GREEN_COLOR,string);
							if(STDPlayer[giveplayerid] > 0)
				            {
								STDPlayer[giveplayerid] = 0;
								SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* You are no longer infected with a STD anymore because of the Medics help !");
							}
						}
						else
						{
							SendClientMessage(playerid, COLOR_GRAD1, "   One of you is not in the Ambulance / Chopper !");
							return 1;
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
						return 1;
					}
				}
			}
			else
			{
				format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}

Fara reclama in semnatura!

Link to comment
Share on other sites

am rezolvat.. am scos

SetPlayerHealth(playerid,100.0);
 format(string, sizeof(string), "* %s puts on body armour.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
TogglePlayerControllable(playerid, 0);
GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
SetPlayerPos(playerid,1527.5,-12.1,1002.0);
PlayerInfo[playerid][pLocal] = 255;
SetPlayerInterior(playerid,99);
Spectate[playerid] = 257;
si am pus
SetPlayerHealth(playerid,100.0);
SetPlayerArmour(playerid,100.0);
format(string, sizeof(string), "* %s puts on body armour.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

:D

Am facut si un mats shop .. stii cumva cum pot sa salvez materialele din shop ? adica daca pun acum in shop 3000 mats dupa restart nu mai sunt .. am incercat da nu mi.a iesit .. :-?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.