HITMAN JOB.
#1

I want to ask some question that i cant found in internet.

How can i make a hitlist and placehit : if player use /placehit [playerid] [money] and i will give money that other place hit on him to player who kill that player.

hitlist show how many people get hit
Reply
#2

Like this-
pawn Код:
new Hit[MAX_PLAYERS];//the variable which stores hits

CMD:placehit(playerid,params[])
{
new tid,a;
if(sscanf(params, "ui", tid, a))return SendClientMessage(playerid,-1,"{ff0000}Correct Usage :{ffffff} /placehit playerid/playername Amount");
if(!IsPlayerConnected(tid))return SendClientMessage(playerid,-1,"{ff0000}No such player online");
if(a<5000)return SendClientMessage(playerid,-1,"{ff0000}Minimum amount {00cc00}5000$");
Hit[tid]=a;
GivePlayerMoney(playerid, -a);
new str[150];
format(str, 150, "A hit has been placed on %s. Amount : %i $",GetName(tid),a);
SendClientMessageToAll(-1, str);
return 1;
}

CMD:hitlist(playerid,params[])
{
new c = 0;
new str[350],s[40];
for(new i =0;i < MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i))continue;
if(!(Hit[i] >= 5000))continue;
format(s,sizeof(s),"%s\t%i $\n",GetName(i), Hit[i]);
strcat(str, s);
c++;
}
if(c==0)return SendClientMessage(playerid,-1,"{ff0000}No Hits");
ShowPlayerDialog(playerid, DIALOg_ID, DIALOG_STYLE_MSGBOX, "Hits", str);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(Hit[playerid] >=5000 && killerid != INVALID_PLAYER_ID)
{
new str[200];
format(str,sizeof(str),"%s completed a hit on %s. Amount - %i $",GetName(killerid),GetName(playerid),Hit[playerid]);
SendClientMessageToAll(-1,str);
GivePlayerMoney(killerid, Hit]playerid]);
Hit[playerid] = 0;
}
return 1;
}
OnPlayerConnect(playerid)
{
Hit[playerid] = 0;//reset hit
return 1;
}
Reply
#3

thank you


but i found some error on your pawn
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(Hit[playerid] >=5000 && killerid != INVALID_PLAYER_ID)
{
new str[200];
format(str,sizeof(str),"%s completed a hit on %s. Amount - %i $",GetName(killerid),GetName(playerid),Hit[playerid]);
SendClientMessageToAll(-1,str);
GivePlayerMoney(killerid, Hit]playerid]);
Hit[playerid] = 0;
}
return 1;
}
Reply
#4

Quote:
Originally Posted by ThunderX
Посмотреть сообщение
thank you


but i found some error on your pawn
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(Hit[playerid] >=5000 && killerid != INVALID_PLAYER_ID)
{
new str[200];
format(str,sizeof(str),"%s completed a hit on %s. Amount - %i $",GetName(killerid),GetName(playerid),Hit[playerid]);
SendClientMessageToAll(-1,str);
GivePlayerMoney(killerid, Hit[playerid]);
Hit[playerid] = 0;
}
return 1;
}
Just a ']'

And also add this stock

pawn Код:
stock GetName(playerid)
{
    new name[24];
    GetPlayerName(playerid,name,sizeof(name));
    return name;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)