Any Solution?Problem :(
#1

I have Maded a /Medkit Command Which Get's 5000$ And Set Player's Health To 100 So this works but i want when the player health is 100 it says Your Health is Already Full/100.0. Well I've Tryed To Make this
pawn Код:
if (strcmp("/MedKit", cmdtext, true, 8) == 0)
        {
        if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFF0000AA, " You dont have enough money!");
        if(GetPlayerHealth(playerid) < 100) return SendClientMessage(playerid, 0xFF0000AA, "Your Health Is Already Full!");
        {
        GivePlayerMoney(playerid, -5000);
        SetPlayerHealth(playerid,100);
        }
        return 1;
  }
But This Error
pawn Код:
I:\Games\RockStar Game Gta San Andreas\Gta Sanandreas\My Script\gamemodes\MyScript.pwn(1737) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Reply
#2

pawn Код:
if (strcmp("/MedKit", cmdtext, true, 8) == 0)
{
        new Float:health;GetPlayerHealth(playerid,health);
        if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFF0000AA, " You dont have enough money!");
        if(health > 99) return SendClientMessage(playerid, 0xFF0000AA, "Your Health Is Already Full!");
        {
        GivePlayerMoney(playerid, -5000);
        SetPlayerHealth(playerid,100);
        }
        return 1;
}
Reply
#3

Quote:
Originally Posted by gamer931215
Посмотреть сообщение
pawn Код:
if (strcmp("/MedKit", cmdtext, true, 8) == 0)
{
        new Float:health;GetPlayerHealth(playerid,health);
        if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFF0000AA, " You dont have enough money!");
        if(health < 100) return SendClientMessage(playerid, 0xFF0000AA, "Your Health Is Already Full!");
        {
        GivePlayerMoney(playerid, -5000);
        SetPlayerHealth(playerid,100);
        }
        return 1;
}
Thanks
EDIT: It's Still Getting Money.... and Don't Say Your Health is Already Full
Reply
#4

Quote:
Originally Posted by Roomeo
Посмотреть сообщение
EDIT: It's Still Getting Money.... and Don't Say Your Health is Already Full
What do you mean exactly ? are you sure you also changed "if(health > 99)" ?
Reply
#5

Well i want if my health is 100 it don't get money and say your health is already 100
pawn Код:
if (strcmp("/MedKit", cmdtext, true, 8) == 0)
{
        new Float:health;GetPlayerHealth(playerid,health);
        if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFF0000AA, " You dont have enough money!");
        if(health < 100) return SendClientMessage(playerid, 0xFF0000AA, "Your Health Is Already Full!");
        {
        GivePlayerMoney(playerid, -5000);
        SetPlayerHealth(playerid,100);
        }
        return 1;
}
it Don''t says your health..... and get the money
Reply
#6

Quote:
Originally Posted by Roomeo
Посмотреть сообщение
Well i want if my health is 100 it don't get money and say your health is already 100
pawn Код:
if (strcmp("/MedKit", cmdtext, true, 8) == 0)
{
        new Float:health;GetPlayerHealth(playerid,health);
        if(GetPlayerMoney(playerid) < 5000) return SendClientMessage(playerid, 0xFF0000AA, " You dont have enough money!");
        if(health < 100) return SendClientMessage(playerid, 0xFF0000AA, "Your Health Is Already Full!");
        {
        GivePlayerMoney(playerid, -5000);
        SetPlayerHealth(playerid,100);
        }
        return 1;
}
it Don''t says your health..... and get the money
Well yes, you have this:
pawn Код:
if(health < 100) return SendClientMessage(playerid, 0xFF0000AA, "Your Health Is Already Full!");
Код:
<
This equals to "Is less as", so you are actually using "If the player health is less as 100, stop the command and return the message".

You should use this instead:

pawn Код:
if(health > 99) return SendClientMessage(playerid, 0xFF0000AA, "Your Health Is Already Full!");
This means if the health is above 99 (so if its 100 or above, aka when the health is full), THEN return the message.
Reply
#7

oh Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)