Help me +1 rep - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help me +1 rep (
/showthread.php?tid=337092)
Help me for command +1 rep -
sscarface - 24.04.2012
i have /hit or /hitlist command but i want add /cancelhit command example if u /hit any player and u want i cancelhit so i need /cancelhit command and u can /cancelhit in 60 sec after u can't cancelhit
and this is my gm hit line:
Code:
if(!strcmp(cmdtext, "/hitlist", true))
{
new count = 0;
SendClientMessage(playerid, COLOR_MSG, "Listing currently placed hits:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && hit[i] > 0)
{
new string[256];
format(string, 256, "Hit on %s (%i) for $%i", ReturnPlayerName(i), i, hit[i]);
SendClientMessage(playerid, COLOR_FOUND, string);
count++;
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_ERROR, "No hits placed at this time!");
}
}
and
Code:
dcmd_hit(playerid, params[])
{
new amount, ID;
if(sscanf(params, "dd", ID, amount))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /hit [ID] [amount]");
}
else if(amount > 0)
{
if(IsPlayerConnected(ID))
{
if(gTeam[playerid] != COP && gTeam[playerid] != SWAT && gTeam[playerid] != FBI && gTeam[playerid] != ARMY)
{
if(GetPlayerMoney(playerid) >= amount)
{
if(antispam[playerid] == 0)
{
hit[ID] = amount;
hiter[ID] = playerid;
new string[256];
format(string, sizeof(string), "You have placed a hit on %s (%i) for $%i", ReturnPlayerName(ID), ID, amount);
SendClientMessage(playerid, COLOR_MSG, string);
format(string, sizeof(string), "%s (%i) has placed a hit on %s (%i) for $%i", ReturnPlayerName(playerid), playerid, ReturnPlayerName(ID), ID, amount);
SendClientMessageToAll(COLOR_MSG, string);
antispam[playerid] = 1;
SetTimerEx("antispamtimer", ANTISPAM_TIME*1000, false, "d", playerid);
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "Please wait before placing another hit!");
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "You do not have enough money!");
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "You team cannot hit an player!");
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "That player is not connected!");
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "Minimum amount to hit a person with is $1!");
}
return 1;
}
can u give me /cancelhit command code and sorry my english is poor but i hope u understand
Re: Help me +1 rep -
Squirrel - 25.04.2012
Make hit with new
new Hit;
and then simply add
PHP Code:
if(strcmp("/cancelhit", cmdtext, true) == 0)
{
if(Hit ....
if you want it easier make
PHP Code:
if(strcmp("/cancelhit", cmdtext, true) == 0)
{
if(IsPlayerOnHit(playerid)) return SendClientMessage(playerid, COLOR, "<!>You are already on a hit");
{
......