Guten Tag,
Da ich noch ein Anfänger bin und nicht soviel ahnung hab bitte ich um hilfe.
Ich haben Bedürfniss- System gefunden was alles besitzt außer Energie und ich wollte fragen ob mir jemand das mit Energie rein scripten kann oder erklären.
/*
* Includes
*/
#include <a_samp>
/*
* Definitionen
*/
// 1000 = 1 Sekunde | 60000 = 1 Minute
#define HUNGER_TIME 90000 // wird alle 90 Sekunden wiederholt
#define DURST_TIME 60000 // wird alle 60 Sekunden wiederholt
#define HARNDRANG_TIME 120000 // wird alle 120 Sekunden wiederholt
//
new Text:TDheadHG, Text:TDhead, Text:TDheadPts, Text:TDtextHG, Text:TDtext, Text:TDtextStateA[MAX_PLAYERS], Text:TDtextStateB[MAX_PLAYERS], Text:TDtextStateC[MAX_PLAYERS];
new timerInfo, timerHunger, timerDurst, timerHarndrang;
//
forward TDinfos();
forward hungerTimer();
forward durstTimer();
forward peeTimer();
forward peeCommand();
forward getHStatus(playerid);
forward getDStatus(playerid);
forward getPStatus(playerid);
forward updateHStatus(playerid, value);
forward updateDStatus(playerid, value);
forward updatePStatus(playerid, value);
/*
* Initialisierung
*/
public OnFilterScriptInit()
{
//
// TextDraws
//
TDheadHG = TextDrawCreate(499.000000, 117.000000, "~n~");
TextDrawBackgroundColor(TDheadHG, 255);
TextDrawFont(TDheadHG, 2);
TextDrawLetterSize(TDheadHG, 0.319999, 1.399999);
TextDrawColor(TDheadHG, -256);
TextDrawSetOutline(TDheadHG, 0);
TextDrawSetProportional(TDheadHG, 1);
TextDrawSetShadow(TDheadHG, 1);
TextDrawUseBox(TDheadHG, 1);
TextDrawBoxColor(TDheadHG, 150);
TextDrawTextSize(TDheadHG, 606.000000, 0.000000);
TDhead = TextDrawCreate(507.000000, 117.000000, "bedurfnisse");
TextDrawBackgroundColor(TDhead, 255);
TextDrawFont(TDhead, 2);
TextDrawLetterSize(TDhead, 0.329999, 1.299999);
TextDrawColor(TDhead, -1);
TextDrawSetOutline(TDhead, 0);
TextDrawSetProportional(TDhead, 1);
TextDrawSetShadow(TDhead, 1);
TDheadPts = TextDrawCreate(536.000000, 110.000000, "..");
TextDrawBackgroundColor(TDheadPts, 255);
TextDrawFont(TDheadPts, 2);
TextDrawLetterSize(TDheadPts, 0.219999, 1.299999);
TextDrawColor(TDheadPts, -1);
TextDrawSetOutline(TDheadPts, 0);
TextDrawSetProportional(TDheadPts, 1);
TextDrawSetShadow(TDheadPts, 0);
TDtextHG = TextDrawCreate(499.000000, 132.000000, "~n~");
TextDrawBackgroundColor(TDtextHG, 255);
TextDrawFont(TDtextHG, 2);
TextDrawLetterSize(TDtextHG, 0.319999, 3.500000);
TextDrawColor(TDtextHG, -256);
TextDrawSetOutline(TDtextHG, 0);
TextDrawSetProportional(TDtextHG, 1);
TextDrawSetShadow(TDtextHG, 1);
TextDrawUseBox(TDtextHG, 1);
TextDrawBoxColor(TDtextHG, 100);
TextDrawTextSize(TDtextHG, 606.000000, 0.000000);
TDtext = TextDrawCreate(501.000000, 134.000000, "Hunger~n~Durst~n~Harndrang");
TextDrawBackgroundColor(TDtext, 255);
TextDrawFont(TDtext, 2);
TextDrawLetterSize(TDtext, 0.209999, 1.000000);
TextDrawColor(TDtext, -1515870721);
TextDrawSetOutline(TDtext, 0);
TextDrawSetProportional(TDtext, 1);
TextDrawSetShadow(TDtext, 1);
for(new i = 0; i < MAX_PLAYERS; i++)
{
TDtextStateA[i] = TextDrawCreate(560.000000, 134.000000, " ");
TextDrawBackgroundColor(TDtextStateA[i], 255);
TextDrawFont(TDtextStateA[i], 2);
TextDrawLetterSize(TDtextStateA[i], 0.189999, 1.000000);
TextDrawColor(TDtextStateA[i], 794437375);
TextDrawSetOutline(TDtextStateA[i], 0);
TextDrawSetProportional(TDtextStateA[i], 1);
TextDrawSetShadow(TDtextStateA[i], 1);
TDtextStateB[i] = TextDrawCreate(560.000000, 143.000000, " ");
TextDrawBackgroundColor(TDtextStateB[i], 255);
TextDrawFont(TDtextStateB[i], 2);
TextDrawLetterSize(TDtextStateB[i], 0.189999, 1.000000);
TextDrawColor(TDtextStateB[i], 794437375);
TextDrawSetOutline(TDtextStateB[i], 0);
TextDrawSetProportional(TDtextStateB[i], 1);
TextDrawSetShadow(TDtextStateB[i], 1);
TDtextStateC[i] = TextDrawCreate(560.000000, 152.000000, " ");
TextDrawBackgroundColor(TDtextStateC[i], 255);
TextDrawFont(TDtextStateC[i], 2);
TextDrawLetterSize(TDtextStateC[i], 0.189999, 1.000000);
TextDrawColor(TDtextStateC[i], 794437375);
TextDrawSetOutline(TDtextStateC[i], 0);
TextDrawSetProportional(TDtextStateC[i], 1);
TextDrawSetShadow(TDtextStateC[i], 1);
}
//
// Timer
//
timerInfo = SetTimer("TDinfos", 1000, true); // Aktualisierung der TextDraws
timerHunger = SetTimer("hungerTimer", HUNGER_TIME, true);
timerDurst = SetTimer("durstTimer", DURST_TIME, true);
timerHarndrang = SetTimer("peeTimer", HARNDRANG_TIME, true);
return 1;
}
public OnFilterScriptExit()
{
KillTimer(timerInfo);
KillTimer(timerHunger);
KillTimer(timerDurst);
KillTimer(timerHarndrang);
return 1;
}
/*
* Funktionen
*/
public OnPlayerConnect(playerid)
{
SetPVarInt(playerid, "statusHunger", 10);
SetPVarInt(playerid, "statusDurst", 10);
SetPVarInt(playerid, "statusHarndrang", 3);
return 1;
}
public OnPlayerDisconnect(playerid)
{
DeletePVar(playerid, "statusHunger");
DeletePVar(playerid, "statusDurst");
DeletePVar(playerid, "statusHarndrang");
return 1;
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid, TDheadHG);
TextDrawShowForPlayer(playerid, TDhead);
TextDrawShowForPlayer(playerid, TDheadPts);
TextDrawShowForPlayer(playerid, TDtextHG);
TextDrawShowForPlayer(playerid, TDtext);
TextDrawShowForPlayer(playerid, TDtextStateA[playerid]);
TextDrawShowForPlayer(playerid, TDtextStateB[playerid]);
TextDrawShowForPlayer(playerid, TDtextStateC[playerid]);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
TextDrawHideForPlayer(playerid, TDheadHG);
TextDrawHideForPlayer(playerid, TDhead);
TextDrawHideForPlayer(playerid, TDheadPts);
TextDrawHideForPlayer(playerid, TDtextHG);
TextDrawHideForPlayer(playerid, TDtext);
TextDrawHideForPlayer(playerid, TDtextStateA[playerid]);
TextDrawHideForPlayer(playerid, TDtextStateB[playerid]);
TextDrawHideForPlayer(playerid, TDtextStateC[playerid]);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/pinkeln", cmdtext, true, 10) == 0)
{
if(GetPVarInt(playerid, "statusHarndrang") < 10)
{
SetPlayerSpecialAction(playerid, 68);
SetTimer("peeCommand", 5000, false);
return 1;
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "Derzeit musst Du nicht pinkeln.");
return 1;
}
}
return 0;
}
//
public TDinfos()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
switch(GetPVarInt(i, "statusHunger"))
{
case 0: TextDrawSetString(TDtextStateA[i], "~r~i");
case 1: TextDrawSetString(TDtextStateA[i], "~r~i");
case 2: TextDrawSetString(TDtextStateA[i], "~r~i i");
case 3: TextDrawSetString(TDtextStateA[i], "~r~i i i");
case 4: TextDrawSetString(TDtextStateA[i], "~y~i i i i");
case 5: TextDrawSetString(TDtextStateA[i], "~y~i i i i i");
case 6: TextDrawSetString(TDtextStateA[i], "~y~i i i i i i");
case 7: TextDrawSetString(TDtextStateA[i], "~y~i i i i i i i");
case 8: TextDrawSetString(TDtextStateA[i], "i i i i i i i i");
case 9: TextDrawSetString(TDtextStateA[i], "i i i i i i i i i");
case 10: TextDrawSetString(TDtextStateA[i], "i i i i i i i i i i");
default: TextDrawSetString(TDtextStateA[i], "i i i i i i i i i i");
}
switch(GetPVarInt(i, "statusDurst"))
{
case 0: TextDrawSetString(TDtextStateB[i], "~r~i");
case 1: TextDrawSetString(TDtextStateB[i], "~r~i");
case 2: TextDrawSetString(TDtextStateB[i], "~r~i i");
case 3: TextDrawSetString(TDtextStateB[i], "~r~i i i");
case 4: TextDrawSetString(TDtextStateB[i], "~y~i i i i");
case 5: TextDrawSetString(TDtextStateB[i], "~y~i i i i i");
case 6: TextDrawSetString(TDtextStateB[i], "~y~i i i i i i");
case 7: TextDrawSetString(TDtextStateB[i], "~y~i i i i i i i");
case 8: TextDrawSetString(TDtextStateB[i], "i i i i i i i i");
case 9: TextDrawSetString(TDtextStateB[i], "i i i i i i i i i");
case 10: TextDrawSetString(TDtextStateB[i], "i i i i i i i i i i");
default: TextDrawSetString(TDtextStateB[i], "i i i i i i i i i i");
}
switch(GetPVarInt(i, "statusHarndrang"))
{
case 0: TextDrawSetString(TDtextStateC[i], "~r~i");
case 1: TextDrawSetString(TDtextStateC[i], "~r~i");
case 2: TextDrawSetString(TDtextStateC[i], "~r~i i");
case 3: TextDrawSetString(TDtextStateC[i], "~r~i i i");
case 4: TextDrawSetString(TDtextStateC[i], "~y~i i i i");
case 5: TextDrawSetString(TDtextStateC[i], "~y~i i i i i");
case 6: TextDrawSetString(TDtextStateC[i], "~y~i i i i i i");
case 7: TextDrawSetString(TDtextStateC[i], "~y~i i i i i i i");
case 8: TextDrawSetString(TDtextStateC[i], "i i i i i i i i");
case 9: TextDrawSetString(TDtextStateC[i], "i i i i i i i i i");
case 10: TextDrawSetString(TDtextStateC[i], "i i i i i i i i i i");
default: TextDrawSetString(TDtextStateC[i], "i i i i i i i i i i");
}
}
}
return 1;
}
public hungerTimer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPVarInt(i, "statusHunger") >= 1)
{
new HS = (GetPVarInt(i, "statusHunger") - 1);
SetPVarInt(i, "statusHunger", HS);
}
else
{
new Float:pHealth;
GetPlayerHealth(i, pHealth);
SetPlayerHealth(i, (pHealth - 5));
}
}
}
return 1;
}
public durstTimer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPVarInt(i, "statusDurst") >= 1)
{
new DS = (GetPVarInt(i, "statusDurst") - 1);
SetPVarInt(i, "statusDurst", DS);
}
else
{
new Float:pHealth;
GetPlayerHealth(i, pHealth);
SetPlayerHealth(i, (pHealth - 5));
}
}
}
return 1;
}
public peeTimer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(GetPVarInt(i, "statusHarndrang") >= 1)
{
new PS = (GetPVarInt(i, "statusHarndrang") - 1);
SetPVarInt(i, "statusHarndrang", PS);
}
else
{
new Float:pHealth;
GetPlayerHealth(i, pHealth);
SetPlayerHealth(i, (pHealth - 5));
}
}
}
return 1;
}
public peeCommand()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetPlayerSpecialAction(i, 0);
SetPVarInt(i, "statusHarndrang", 11);
}
}
return 1;
}
public getHStatus(playerid)
{
return GetPVarInt(playerid, "statusHunger");
}
public getDStatus(playerid)
{
return GetPVarInt(playerid, "statusDurst");
}
public getPStatus(playerid)
{
return GetPVarInt(playerid, "statusHarndrang");
}
public updateHStatus(playerid, value)
{
SetPVarInt(playerid, "statusHunger", value);
return 1;
}
public updateDStatus(playerid, value)
{
SetPVarInt(playerid, "statusDurst", value);
return 1;
}
public updatePStatus(playerid, value)
{
SetPVarInt(playerid, "statusHarndrang", value);
return 1;
}
Mit freundlichen Grüßen
IceboyTea
//Edit in PWN eingefügt