13.03.2014, 19:59
First of all, sorry if this question is pretty dumb but im using PAWN for just a few weeks (used to do it a long time ago) and want to do the following.
I want to check if a player has enough heal to use the /heal command, if it is above 50 it will use else.
There comes the problem when the player needs to heal himself the server first needs to check wether the player has enough money, but I also want to show him in the same line as I send him he doesn't have enough money his actual money and the money he needs.
So in short I want the sentence to show: You haven't got enough money to heal yourself (your money: x | needed: 1000)
This is my code for now:
I want to check if a player has enough heal to use the /heal command, if it is above 50 it will use else.
There comes the problem when the player needs to heal himself the server first needs to check wether the player has enough money, but I also want to show him in the same line as I send him he doesn't have enough money his actual money and the money he needs.
So in short I want the sentence to show: You haven't got enough money to heal yourself (your money: x | needed: 1000)
This is my code for now:
Код:
if (strcmp("/heal", cmdtext, true, 10) ==0) { new Float:Health; GetPlayerHealth(playerid, Health); if (Health < 50.0) { SendClientMessage(playerid,0xD10000FF, "You are too low on health to heal yourself!"); return 1; } else { if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid,0xD10000FF ,"You haven't got enough money to heal yourself (Your money: $i% Needed: $1000)"); SetPlayerHealth(playerid, 100); SendClientMessage(playerid,0x009900FF,"You have healed yourself for $1000!"); GivePlayerMoney(playerid, -1000); return 1; } }