Commands Problem
#1

Код:
CMD:hit(playerid, params[])
{
    new amount;
    if(sscanf(params, "ud", ID, amount)) return SendClientMessage(playerid, RED, "[USAGE]: /hit [name/id] [amount]");
	if(amount < 10000) return SendClientMessage(playerid, COLOR_AQUA, "The hit must be atleast $10K.");
	if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, RED, "Player not found.");
	if(ID == playerid) return SendClientMessage(playerid, COLOR_AQUA, "You cant place a hit on yourself.");
	if(GetPlayerCash(playerid) < amount) return SendClientMessage(playerid, RED, "Insufficient funds.");
	if(HasHit[ID] > 0) return SendClientMessage(playerid, COLOR_AQUA, "That player already has a hit contract placed on them.");
	{
	    HasHit[ID] = amount;
	    HasPlacedHit[ID] = playerid;
		format(fstr, sizeof(fstr), "You have placed a hit on %s [%d] for $%d.", GetName(ID), ID, amount);
		SendClientMessage(playerid, COLOR_AQUA, fstr);
		GameTextForPlayer(playerid,"HIT PLACE ON %s FOR $%d ", 5000, 5);
		format(fstr2, sizeof(fstr2), "[HIT]: %s [%d] has placed a hit contract on %s [%d] for $%d.", GetName(playerid), playerid, GetName(ID), ID, amount);
		SendClientMessageToAll(COLOR_AQUA, fstr2);
		SendClientMessage(ID, COLOR_AQUA, "You now have a hit contract!");
	}
    return true;
}
Quote:

GameTextForPlayer(playerid,"HIT PLACE ON %s FOR $%d ", 5000, 5);

I want put game textdraw when a player hit someone so gametextdraw show to player "GameTextForPlayer(playerid,"HIT PLACE ON %s FOR $%d ", 5000, 5);" like this but it don't work can u help me?
Reply
#2

pawn Код:
CMD:hit(playerid, params[])
{
    new amount,stringx[128],tname[MAX_PLAYER_NAME];
    if(sscanf(params, "ud", ID, amount)) return SendClientMessage(playerid, RED, "[USAGE]: /hit [name/id] [amount]");
    if(amount < 10000) return SendClientMessage(playerid, COLOR_AQUA, "The hit must be atleast $10K.");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, RED, "Player not found.");
    if(ID == playerid) return SendClientMessage(playerid, COLOR_AQUA, "You cant place a hit on yourself.");
    if(GetPlayerCash(playerid) < amount) return SendClientMessage(playerid, RED, "Insufficient funds.");
    if(HasHit[ID] > 0) return SendClientMessage(playerid, COLOR_AQUA, "That player already has a hit contract placed on them.");
    {
        HasHit[ID] = amount;
        HasPlacedHit[ID] = playerid;
        GetPlayerName(ID,tname,MAX_PLAYER_NAME);
        format(fstr, sizeof(fstr), "You have placed a hit on %s [%d] for $%d.", GetName(ID), ID, amount);
        SendClientMessage(playerid, COLOR_AQUA, fstr);
        format(stringx,sizeof(stringx),"HIT PLACED ON %s FOR $%d",tname,amount);
        GameTextForPlayer(playerid,stringx, 5000, 5);
        format(fstr2, sizeof(fstr2), "[HIT]: %s [%d] has placed a hit contract on %s [%d] for $%d.", GetName(playerid), playerid, GetName(ID), ID, amount);
        SendClientMessageToAll(COLOR_AQUA, fstr2);
        SendClientMessage(ID, COLOR_AQUA, "You now have a hit contract!");
    }
    return true;
}
Reply
#3

Use format for that and send the formatted text. Though, in your case, you don't need to do it since you know the numbers.
pawn Код:
GameTextForPlayer(playerid,"HIT PLACE ON 5000 FOR $5 ");
Reply
#4

Quote:
Originally Posted by Infinity90
Посмотреть сообщение
pawn Код:
CMD:hit(playerid, params[])
{
    new amount,stringx[128],tname[MAX_PLAYER_NAME];
    if(sscanf(params, "ud", ID, amount)) return SendClientMessage(playerid, RED, "[USAGE]: /hit [name/id] [amount]");
    if(amount < 10000) return SendClientMessage(playerid, COLOR_AQUA, "The hit must be atleast $10K.");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, RED, "Player not found.");
    if(ID == playerid) return SendClientMessage(playerid, COLOR_AQUA, "You cant place a hit on yourself.");
    if(GetPlayerCash(playerid) < amount) return SendClientMessage(playerid, RED, "Insufficient funds.");
    if(HasHit[ID] > 0) return SendClientMessage(playerid, COLOR_AQUA, "That player already has a hit contract placed on them.");
    {
        HasHit[ID] = amount;
        HasPlacedHit[ID] = playerid;
        GetPlayerName(ID,tname,MAX_PLAYER_NAME);
        format(fstr, sizeof(fstr), "You have placed a hit on %s [%d] for $%d.", GetName(ID), ID, amount);
        SendClientMessage(playerid, COLOR_AQUA, fstr);
        format(stringx,sizeof(stringx),"HIT PLACED ON %s FOR $%d",tname,amount);
        GameTextForPlayer(playerid,stringx, 5000, 5);
        format(fstr2, sizeof(fstr2), "[HIT]: %s [%d] has placed a hit contract on %s [%d] for $%d.", GetName(playerid), playerid, GetName(ID), ID, amount);
        SendClientMessageToAll(COLOR_AQUA, fstr2);
        SendClientMessage(ID, COLOR_AQUA, "You now have a hit contract!");
    }
    return true;
}
thanx , its work.
Reply
#5

but i want like this:

Player A has placed a hit on PLayer B FOR $5000.

Player A: GameTextForPlayer(playerid,"HIT PLACE ON %s FOR $%d ", 5000, 5);
Player B: GameTextForPlayer(playerid,"HIT PLACED ON YOU BY %s. ", 5000, 5);
Reply
#6

pawn Код:
CMD:hit(playerid, params[])
{
    new amount,stringx[128],tname[MAX_PLAYER_NAME];
    if(sscanf(params, "ud", ID, amount)) return SendClientMessage(playerid, RED, "[USAGE]: /hit [name/id] [amount]");
    if(amount < 10000) return SendClientMessage(playerid, COLOR_AQUA, "The hit must be atleast worth $10,000.");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, RED, "Player not found.");
    if(ID == playerid) return SendClientMessage(playerid, COLOR_AQUA, "You cannot place a hit on yourself.");
    if(GetPlayerCash(playerid) < amount) return SendClientMessage(playerid, RED, "Insufficient funds.");
    if(HasHit[ID] > 0) return SendClientMessage(playerid, COLOR_AQUA, "That player already has a hit contract placed on them.");
    {
        HasHit[ID] = amount;
        HasPlacedHit[ID] = playerid;
        GetPlayerName(ID,tname,MAX_PLAYER_NAME);
        format(fstr, sizeof(fstr), "You have placed a hit on %s [%d] for $%d.", GetName(ID), ID, amount);
        SendClientMessage(playerid, COLOR_AQUA, fstr);
        format(stringx,sizeof(stringx),"HIT PLACED ON %s FOR $%d",tname,amount);
        GameTextForPlayer(playerid,stringx, 5000, 5);
        format(stringx,sizeof(stringx),"Hit placed on you by: %s",GetName(playerid));
        GameTextForPlayer(playerid,stringx, 5000, 5);
        format(fstr2, sizeof(fstr2), "[HIT]: %s [%d] has placed a hit contract on %s [%d] for $%d.", GetName(playerid), playerid, GetName(ID), ID, amount);
        SendClientMessageToAll(COLOR_AQUA, fstr2);
        SendClientMessage(ID, COLOR_AQUA, "You now have a hit contract!");
    }
    return true;
}
Reply
#7

not working rajat. when i hit a player

1. textdraw show to me, "format(stringx,sizeof(stringx),"Hit placed on you by: %s" this is for 2nd player

2. they dnt show to me you have place a hit on %s. and this is for me , if i hit a player.
Reply
#8

pawn Код:
CMD:hit(playerid, params[])
{
    new amount,stringx[128],tname[MAX_PLAYER_NAME];
    if(sscanf(params, "ud", ID, amount)) return SendClientMessage(playerid, RED, "[USAGE]: /hit [name/id] [amount]");
    if(amount < 10000) return SendClientMessage(playerid, COLOR_AQUA, "The hit must be atleast worth $10,000.");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, RED, "Player not found.");
    if(ID == playerid) return SendClientMessage(playerid, COLOR_AQUA, "You cannot place a hit on yourself.");
    if(GetPlayerCash(playerid) < amount) return SendClientMessage(playerid, RED, "Insufficient funds.");
    if(HasHit[ID] > 0) return SendClientMessage(playerid, COLOR_AQUA, "That player already has a hit contract placed on them.");
    {
        HasHit[ID] = amount;
        HasPlacedHit[ID] = playerid;
        GetPlayerName(ID,tname,MAX_PLAYER_NAME);
        format(fstr, sizeof(fstr), "You have placed a hit on %s [%d] for $%d.", GetName(ID), ID, amount);
        SendClientMessage(playerid, COLOR_AQUA, fstr);
        format(stringx,sizeof(stringx),"HIT PLACED ON %s FOR $%d",tname,amount);
        GameTextForPlayer(playerid,stringx, 5000, 5);
        format(stringx,sizeof(stringx),"Hit placed on you by: %s",GetName(playerid));
        GameTextForPlayer(ID,stringx, 5000, 5);
        format(fstr2, sizeof(fstr2), "[HIT]: %s [%d] has placed a hit contract on %s [%d] for $%d.", GetName(playerid), playerid, GetName(ID), ID, amount);
        SendClientMessageToAll(COLOR_AQUA, fstr2);
        SendClientMessage(ID, COLOR_AQUA, "You now have a hit contract!");
    }
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)