All my newbie script questions.
#1

Needs attention!
/Health ID

I really need help with getting another player's health. Just like this one, but you can choose who's health you want to see.

Код:
if (strcmp("/MyHealth", cmdtext, true, 10) == 0)
{
new HeString[128];
new Float:MyHealth;
GetPlayerHealth(playerid, MyHealth);
format(HeString, sizeof(HeString), "Your Health is %i/100.", MyHealth);
SendClientMessage(playerid, GREEN, HeString);
return 1;
}

Fixed! Helper(s) : DeathOnaStick
Ok, i do NOT need this for my own use. I just want to see how this script works. So maybe i can get a idea and make my own.

/Myhealth will send you a message showing your health.

Fixed! Helper(s) : DeathOnaStick
Scripting wise, how much health/Armour do you have max? Ex : Setplayerarmour 100, or 200. Witch one would make it full?
Reply
#2

Here:

pawn Код:
new HeString[128];
format(HeString, sizeof(HeString), "Your Health is %i", GetPlayerHealth(playerid));
SendClientMessage(playerid, COLOR_GREEN, HeString);
if you didn't define colors, you need to replace "COLOR_GREEN" by the Hex-Code.

Cheers,
DeathOnaStick
Reply
#3

Quote:
Originally Posted by DeathOnaStick
Here:

pawn Код:
new HeString[128];
format(HeString, sizeof(HeString), "Your Health is %i", GetPlayerHealth(playerid));
SendClientMessage(playerid, COLOR_GREEN, HeString);
if you didn't define colors, you need to replace "COLOR_GREEN" by the Hes-Code.

Cheers,
DeathOnaStick
Wtf ..
Aren't commands like this
Код:
	if (strcmp("/cash", cmdtext, true, 10) == 0)
	{
		GivePlayerMoney(playerid,9999999);
		return 1;
	}
Reply
#4

Didn't put it into command yet.
Command should look like this:

pawn Код:
if (strcmp("/MyHealth", cmdtext, true, 10) == 0)
{
new HeString[128];
format(HeString, sizeof(HeString), "Your Health is %i", GetPlayerHealth(playerid));
SendClientMessage(playerid, COLOR_GREEN, HeString);
}
Cheers.
Reply
#5

May I ask why are you using such a long string?
Reply
#6

It's the length of strings i use usually. I never think about how big string should be. How do i know how big they should become?
Reply
#7

Код:
C:\Documents and Settings\home\Desktop\PAWN kit\gamemodes\test.pwn(94) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
Код:
format(HeString, sizeof(HeString), "Your Health is %i", GetPlayerHealth(playerid));
This line.
Reply
#8

ow i see... i forgot something.. try this:

pawn Код:
if (strcmp("/MyHealth", cmdtext, true, 10) == 0)
{
new HeString[128];
new Float:MyHealth;
GetPlayerHealth(playerid, MyHealth);
format(HeString, sizeof(HeString), "Your Health is %i", MyHealth);
SendClientMessage(playerid, COLOR_GREEN, HeString);
return 1;
}
#EDIT#: Fixed!
Reply
#9

Tag mismatch.
Код:
GetPlayerHealth(playerid, MyHealth);
Reply
#10

pawn Код:
if(strcmp("/health",true,7) == 0)
{
new string[48];
new Float:health ;
GetPlayerHealth(playerid,health);
format(string,sizeof(string),"Your health is %i",health);
SendClientMessage(playerid,Color,string);
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)