[LR]Chupa's Wanted System aus dem Showroom
Probier den mal aus..
#include <a_samp>
#include <SII>
#include <dini>
#pragma unused ret_memcpy
#define TDSET 1888
new WantedArt;
new WantedOn;
new Text:Wanteds[MAX_PLAYERS];
forward WantedUpdate(playerid);
forward WantedSternUpdate(playerid);
public OnFilterScriptInit()
{
LoadSet();
print("\n--------------------------------------");
print(" WantedTextdraw by [LR]Chupa");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
SaveSet();
return 1;
}
public OnPlayerConnect(playerid)
{
Wanteds[playerid] = TextDrawCreate(470,105,"~n~ Wanteds: -- ~n~");
TextDrawFont(Wanteds[playerid],2);
TextDrawColor(Wanteds[playerid],0xFFFF00AA);
TextDrawLetterSize(Wanteds[playerid],0.599999,1.000000);
TextDrawSetOutline(Wanteds[playerid],1);
TextDrawSetShadow(Wanteds[playerid],1);
TextDrawSetProportional(Wanteds[playerid],1);
TextDrawBackgroundColor(Wanteds[playerid],0x000000ff);
TextDrawUseBox(Wanteds[playerid], 1);
TextDrawBoxColor(Wanteds[playerid], 0x000000FF);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid,Wanteds[playerid]);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(WantedOn == 1)
{
TextDrawShowForPlayer(playerid,Wanteds[playerid]);
switch(WantedArt)
{
case 0:
{
WantedSternUpdate(playerid);
SetTimerEx("WantedSternUpdate",30000,1,"i",playerid);
}
case 1:
{
WantedUpdate(playerid);
SetTimerEx("WantedUpdate",30000,1,"i",playerid);
}
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/wtd",true)==0)
{
if(IsPlayerAdmin(playerid))
{
ShowPlayerDialog(playerid,TDSET,DIALOG_STYLE_LIST,"Einstellungen"," Wanted-Text Anzeigen\n Wanted-Text nicht Anzeigen\n Wanteds als Sterne\n Wanteds als Nummern","Okay","Abbruch");
}
else
{
SendClientMessage(playerid,0xFFFF00AA,"Du bist nicht dazu Berechtigt!");
}
return 1;
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case TDSET:
{
switch(response)
{
case 1:
{
switch(listitem)
{
case 0:
{
WantedOn = 1;
SendClientMessage(playerid,0xFFFF00AA,"Wanted - Text wird angezeigt!");
ShowWanteds();
}
case 1:
{
SendClientMessage(playerid,0xFFFF00AA,"Wanted - Text Ausgestellt!");
WantedOn = 0;
HideWanteds();
}
case 2:
{
WantedArt = 0;
WantedSternUmstell();
SendClientMessage(playerid,0xFFFF00AA,"Wanteds werden als Sterne Angezeigt!");
}
case 3:
{
WantedArt = 1;
WantedUmstell();
SendClientMessage(playerid,0xFFFF00AA,"Wanteds werden als Nummern angezeigt!");
}
}
}
case 0:
{
SendClientMessage(playerid,0xFFFF00AA,"Abgebrochen");
}
}
}
}
return 1;
}
public WantedUpdate(playerid)
{
if(WantedOn == 1)
{
new Wntd = GetPlayerWantedLevel(playerid);
new string[56];
format(string,56,"~n~ Wanteds: %d ~n~",Wntd);
TextDrawHideForPlayer(playerid,Wanteds[playerid]);
TextDrawSetString(Wanteds[playerid],string);
return TextDrawShowForPlayer(playerid,Wanteds[playerid]);
}
else
{
}
}
public WantedSternUpdate(playerid)
{
if(WantedOn == 1)
{
new Wntd = GetPlayerWantedLevel(playerid);
new string[56];
switch(Wntd)
{
case 0:
{
format(string,56,"~n~ Keine Wanteds ~n~");
}
case 1:
{
format(string,56,"~n~ ~w~] ~n~");
}
case 2:
{
format(string,56,"~n~ ~w~]] ~n~");
}
case 3:
{
format(string,56,"~n~ ~w~]]] ~n~");
}
case 4:
{
format(string,56,"~n~ ]]]] ~n~");
}
case 5:
{
format(string,56,"~n~ ]]]]] ~n~");
}
case 6:
{
format(string,56,"~n~ ~r~]]]]]] ~n~");
}
}
TextDrawHideForPlayer(playerid,Wanteds[playerid]);
TextDrawSetString(Wanteds[playerid],string);
return TextDrawShowForPlayer(playerid,Wanteds[playerid]);
}
else
{
}
}
stock WantedSternUmstell()
{
for(new i=0; i<GetMaxPlayers(); i++)
{
WantedSternUpdate(i);
}
}
stock WantedUmstell()
{
for(new i=0; i<GetMaxPlayers(); i++)
{
WantedUpdate(i);
}
}
stock HideWanteds()
{
for(new i=0; i<GetMaxPlayers(); i++)
{
TextDrawHideForPlayer(i,Wanteds[i]);
}
return 1;
}
stock ShowWanteds()
{
for(new i=0; i<GetMaxPlayers(); i++)
{
TextDrawShowForPlayer(i,Wanteds[i]);
}
return 1;
}
stock LoadSet()
{
new file[128];
format(file,128,"WantedSettings.ini");
if(fexist(file))
{
if(INI_Open(file))
{
WantedOn = INI_ReadInt("WantedAn");
WantedArt = INI_ReadInt("WantedArt");
INI_Close();
}
}
else
{
dini_Create(file);
}
if(WantedOn == 1)
{
ShowWanteds();
}
else
{
HideWanteds();
}
return 1;
}
stock SaveSet()
{
new file[128];
format(file,128,"WantedSettings.ini");
if(fexist(file))
{
if(INI_Open(file))
{
INI_WriteInt("WantedsAn",WantedOn);
INI_WriteInt("WantedArt",WantedArt);
INI_Save();
INI_Close();
}
}
else
{
dini_Create(file);
}
return 1;
}