Most wanted - 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: Most wanted (
/showthread.php?tid=487973)
Most wanted -
MahdiGames - 16.01.2014
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 ?
Re: Most wanted -
MatriXgaMer - 16.01.2014
It is possible.
Re: Most wanted -
Beckett - 16.01.2014
It's very simple you just need a brain and some fingers, create the textdraw, set his wanted level if his wanted level is 5 or w/e then show him that textdraw, when he dies, check if he has got 5 wanted levels, if yes then give the killerid +10 score and 100k (or w/e u want).
Re: Most wanted -
RenSoprano - 16.01.2014
First you will need to create your textdraws then declarate your vars.
Код:
new pWanted[MAX_PLAYERS];
new Text3D:NameTag;[MAX_PLAYERS];
Under OnPlayerConnect
Код:
pWanted[playerid] = 0;
Under OnPlayerDeath
Код:
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;
}
Under OnGameModeInit
Код:
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;
}
I'm from school so you will need to test
Re: Most wanted -
MahdiGames - 16.01.2014
Quote:
Originally Posted by RenSoprano
First you will need to create your textdraws then declarate your vars.
Код:
new pWanted[MAX_PLAYERS];
Under OnPlayerConnect
Код:
pWanted[playerid] = 0;
Under OnPlayerDeath
Код:
pWanted[killerid] += 1;
if(pWanted[killerid] == 5)
{
SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid)+1);
}
|
Thanks but i want a Create3DTextLabel
Re: Most wanted -
SilentSoul - 16.01.2014
What you mean with textdraw tag ? you wanna add textdraw above his character/head ?
pawn Код:
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;
}
EDIT: Ops sorry guys too late
, @topic everything is possible in scripting you just need to think on another options maybe similar to the one you want!
Re: Most wanted -
MahdiGames - 16.01.2014
Thanks alot yeah textdraw above the character
Re: Most wanted -
SilentSoul - 16.01.2014
Quote:
Originally Posted by MahdiGames
Thanks alot yeah textdraw above the character
|
No you can't do that , you can use
Attach3DTextLabelToPlayer
Re: Most wanted -
MahdiGames - 16.01.2014
So just to add the line "Attach3DTextLabelToPlayer(.. under SetPlayerScore..?