16.01.2014, 07:34
Hello, is possible to make most wanted player with TextDraw tag? i mean if he killed more than 5 players ? and who kill this most wanted get +10 score and 10000$ how to script ?
new pWanted[MAX_PLAYERS]; new Text3D:NameTag;[MAX_PLAYERS];
pWanted[playerid] = 0;
pWanted[killerid] += 1; if(pWanted[killerid] == 5) { SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid)+1); }
GetMostWantedPlayer() // Function by SuperVIper { new highPlayerWantedLevel, player = INVALID_PLAYER_ID, wl; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { wl = GetPlayerWantedLevel(i); if(wl > highPlayerWantedLevel) { highPlayerWantedLevel = wl, player = i; } } } return player; }
SetTimer("checkmostwantedplayer", 1000, true);
forward checkmostwantedplayer(playerid); public checkmostwantedplayer() { for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { new score[128], name[MAX_PLAYER_NAME]; GetPlayerName(i, name, sizeof(name)); format(score, sizeof(score), "MostWanted: %s(%d)",name, GetPlayerWantedLevel(i)); NameTag[playerid] = Create3DTextLabel(string, 0xFFFFFFFF, 0, 0, 0, 40, 0, 1 ); Attach3DTextLabelToPlayer(NameTag[playerid], playerid, 0.0, 0.0, 0.2); // With Label } } return 1; }
First you will need to create your textdraws then declarate your vars.
Код:
new pWanted[MAX_PLAYERS]; Код:
pWanted[playerid] = 0; Код:
pWanted[killerid] += 1; if(pWanted[killerid] == 5) { SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid)+1); } |
new Kills[MAX_PLAYERS];
new bool:MostWanted[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
Kills[killerid]++;
Kills[playerid] =0;
if(Kills[killerid] == 5) MostWanted[killerid] = true;
if(MostWanted[playerid]) SetPlayerScore(killerid,GetPlayerScore(playerid)+10) && GivePlayerMoney(playerid,1000);
return 1;
}