Posts: 1,767
Threads: 124
Joined: Mar 2010
You should not create this one topic, just bump the old one and then maybe someone reply you. I've already gave you the code in the old topic.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Check this code.. it's not tested.
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
new bool:pOffersHeal[MAX_PLAYERS] = false;
new Float:HealthAmount;
CMD:heal(playerid, params[])
{
new giveplayerid,
Float:heal,
Float:X, Float:Y, Float:Z;
if(sscanf(params, "df", giveplayerid, heal))return SendClientMessage(playerid, -1, "Type: /heal (playerid) (health)");
{
if(!IsPlayerConnected(giveplayerid) || giveplayerid == playerid)
{
SendClientMessage(playerid, -1, "Error: Unable to find this player.");
return true;
}
GetPlayerPos(playerid, X, Y, Z);
if(!IsPlayerInRangeOfPoint(giveplayerid, 5.0, X, Y, Z))
{
SendClientMessage(playerid, -1, "Error: This player is too far from you!");
return true;
}
new string[128];
format(string, sizeof(string), "You've received an offer to heal you by %2.1f", heal);
SendClientMessage(giveplayerid, -1, string);
SendClientMessage(giveplayerid, -1, "Type in the chat \"Yes\" or \"No\" to reply the offer.");
pOffersHeal[giveplayerid] = true;
HealthAmount = heal;
}
return true;
}
public OnPlayerText(playerid, text[])
{
if(pOffersHeal[playerid])
{
if(strcmp(text, "Yes", true) == 0)
{
SetPlayerHealth(playerid, HealthAmount);
}
else if(strcmp(text, "No", true) == 0)
{
GameTextForPlayer(playerid, "Canceled heal offer", 3000, 3);
}
return true;
}
return true;
}
Posts: 1,767
Threads: 124
Joined: Mar 2010
Indentation!!!
pawn Код:
public OnPlayerText(playerid, text[])
{
if(pOffersHeal[playerid])
{
if(strcmp(text, "Yes", true) == 0)
{
SetPlayerHealth(playerid, HealthAmount);
}
else if(strcmp(text, "No", true) == 0)
{
GameTextForPlayer(playerid, "Canceled heal offer", 3000, 3);
}
return true;
}
new realchat = 1, string[ 128 ];
if(IsPlayerConnected(playerid))
{
if(realchat)
{
if(PlayerInfo[playerid][pAccent] == 0)
{
format(string, sizeof(string), "%s Mowi: %s", RPName(playerid), text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_F ADE4,COLOR_FADE5);
}
}
else
{
new accent[20];
switch(PlayerInfo[playerid][pAccent])
{
case 1: accent = "Russian";
case 2: accent = "Italian";
case 3: accent = "Germany";
case 4: accent = "Japanese";
case 5: accent = "French";
case 6: accent = "Spain";
case 7: accent = "China";
case 8: accent = "British";
}
format(string, sizeof(string), "%s Mowi: [%s Accent] %s", RPName(playerid), accent, text);
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_F ADE4,COLOR_FADE5);
}
}
return 1;
}