Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //== na vrh
- #define STARTING_GLAD 100
- #define STARTING_WC 100
- forward GladWCCheck();
- new PlayerText:Texttdraw4[MAX_PLAYERS];
- //
- // pod
- public OnPlayerConnect(playerid)
- {
- SetPVarInt(playerid, "glad", STARTING_GLAD); // Govori igraecvu glad
- SetPVarInt(playerid, "wc", STARTING_WC); // Govori igracev wc
- SetPVarInt(playerid, "showinggw", 0); // Govori dali prikazuje text za glad i wc
- Texttdraw4[playerid] = CreatePlayerTextDraw(playerid,499.000000, 430.000000, "GLAD: 100% W~C: 100%");
- PlayerTextDrawLetterSize(playerid,Texttdraw4[playerid],0.279999, 1.199999);
- PlayerTextDrawBackgroundColor(playerid,Texttdraw4[playerid],255);
- PlayerTextDrawColor(playerid,Texttdraw4[playerid],-500552961);
- PlayerTextDrawFont(playerid,Texttdraw4[playerid],2);
- PlayerTextDrawSetOutline(playerid,Texttdraw4[playerid],0);
- PlayerTextDrawSetProportional(playerid,Texttdraw4[playerid],1);
- PlayerTextDrawSetShadow(playerid,Texttdraw4[playerid],0);
- return 1;
- }
- // pod
- public OnPlayerSpawn(playerid)
- {
- if(GetPVarInt(playerid, "showinggw") == 0) {
- SetPVarInt(playerid, "showinggw", 1);
- UpdateGladWCText(playerid);
- PlayerTextDrawShow(playerid, Texttdraw4[playerid]); }
- return 1;
- }
- // pod
- public OnGameModeInit()
- {
- SetTimer("GladWCCheck", 60000, 1); // za svaku minutu
- return 1;
- }
- // negdje na kraj
- stock GiveGlad(playerid, glad) {
- SetPVarInt(playerid, "glad", GetPVarInt(playerid, "glad")+glad);
- if(GetPVarInt(playerid, "glad") > 100) { SetPVarInt(playerid, "glad", 100); }
- return 1; }
- stock GiveWC(playerid, wc) {
- SetPVarInt(playerid, "wc", GetPVarInt(playerid, "wc")+wc);
- if(GetPVarInt(playerid, "wc") > 100) { SetPVarInt(playerid, "wc", 100); }
- return 1; }
- public GladWCCheck() {
- for(new i=0;i<MAX_PLAYERS;i++) {
- if(IsPlayerConnected(i)) {
- new Float:phealth; GetPlayerHealth(i, phealth);
- GiveGlad(i, -1);
- if(GetPVarInt(i, "glad") < 0) { SetPVarInt(i, "glad", 0); SetPlayerHealth(i, phealth-1); }
- GiveWC(i, -1);
- if(GetPVarInt(i, "wc") < 0) { SetPVarInt(i, "wc", 0); SetPlayerHealth(i, phealth-1); }
- UpdateGladWCText(i); } }
- return 1; }
- stock UpdateGladWCText(playerid) {
- if(!IsPlayerConnected(playerid)) { return 1; }
- new str[128];
- format(str, sizeof(str), "GLAD: %d ~w~WC:~w~ %d", GetPVarInt(playerid, "glad"), GetPVarInt(playerid, "wc"));
- PlayerTextDrawSetString(playerid, Texttdraw4[playerid], str);
- return 1; }
Advertisement
Add Comment
Please, Sign In to add comment