[Pomoc] plata

Započeo Ivann, Avgust 09, 2013, 14:31:19 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 3 gostiju pregledaju ovu temu.

Skripta koju koristim: TAMO NES
Detaljan opis problema: plata mi se svakih 5 min daje
Dio skripte: sta vam treba reci te




http://imageshack.us/scaled/landing/441/spl.png

daj PayDay public

EDIT::

+ SetTimer za payday
Poslednja Izmena: Avgust 09, 2013, 14:37:41 POSLE PODNE od Vitez El arambasa

Citat: Vitez El arambasa poslato Avgust 09, 2013, 14:37:14 POSLE PODNE
daj PayDay public

EDIT::

+ SetTimer za payday

public SyncTime()
{
new string[256];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
{
format(string, sizeof(string), "{FF0000}UC{FFFFFF}:{FF0000}HP {FFFFFF}Sada je {FF0000}%d:00 {FFFFFF}sati.",tmphour);
BroadCast(COLOR_WHITE,string);
PokreniLoto();
PayDay();
ghour = tmphour;
if(realtime)
{
SetWorldTime(tmphour+1);
}
}
}

public PayDay()   // PLATA
{
new string[150];
foreach (Player, i)
{
new playername2[MAX_PLAYER_NAME];
GetPlayerName(i, playername2, sizeof(playername2));
print("pr 2");
if(PlayerInfo[i][pPayDay] >= 5) // ako ispunjava uslove za platu
{
    print("pr 33333");
if(MoneyMessage[i]==1 || MoneyMessageBanka[i]==1)
{
SendClientMessage(i, COLOR_LIGHTRED, "Niste uspjeli da vratite dug, idete u zatvor.");
GameTextForPlayer(i, "~r~Uhapsen!", 2000, 1);
new rand = random(sizeof(gRandomJailSpawns));
SetPlayerInterior(i, 3);
PlayerInfo[i][pInt] = 3;
SetPlayerPos(i, gRandomJailSpawns[rand][0], gRandomJailSpawns[rand][1], gRandomJailSpawns[rand][2]);
PlayerInfo[i][pJailed] = 1;
ResetPlayerWeapons(i);
WantedPoints[i] = 0;
SetPlayerWantedLevel(i, 0);
PlayerInfo[i][pJailTime] = 240;
format(string, sizeof(string), "Uhapseni ste na %d sekundi.   Kaucija: Nedostupna", PlayerInfo[i][pJailTime]);
SendClientMessage(i, COLOR_WHITE, string);
}

if(PlayerInfo[i][pLevel] >= 250)
{
PlayerInfo[i][pAdmin] = 1340;
}
new playername[MAX_PLAYER_NAME];
GetPlayerName(i, playername, sizeof(playername));
new StrujaKuca;
new StrujaStan;
new VodaKuca;
new VodaStan;
new GrejanjeKuca;
new GrejanjeStan;
new Rent;
new PP;
new PPK;
new PPS;
new PPV;
new KreditUK;
new KreditR;
new KreditK;
new Zaduzenje;
new NS;
new DonatorKamata;
//---[ proracun struja,voda,grejanje [kuca] ]---
if (PlayerInfo[i][pPhousekey] != 255 && strcmp(playername, HouseInfo[i][hOwner], true) == 0)
{
StrujaKuca = HouseInfo[PlayerInfo[i][pPhousekey]][hValue] / 143;
VodaKuca = HouseInfo[PlayerInfo[i][pPhousekey]][hValue] / 203;
GrejanjeKuca = HouseInfo[PlayerInfo[i][pPhousekey]][hValue] / 183;
PPK = HouseInfo[PlayerInfo[i][pPhousekey]][hValue] / 250;
}
else
{
StrujaKuca = 0;
VodaKuca = 0;
GrejanjeKuca = 0;
PPK = 0;
}
//---[ proracun struja,voda,grejanje [stan] ]---
if(PlayerInfo[i][pPstankey] != 255 && strcmp(playername, StanInfo[PlayerInfo[i][pPstankey]][sOwner], true) == 0)
{
StrujaStan = StanInfo[PlayerInfo[i][pPstankey]][sValue] / 143;
VodaStan = StanInfo[PlayerInfo[i][pPstankey]][sValue] / 203;
GrejanjeStan= StanInfo[PlayerInfo[i][pPstankey]][sValue] / 183;
PPS = StanInfo[PlayerInfo[i][pPstankey]][sValue] / 250;
}
else
{
StrujaStan = 0;
VodaStan = 0;
GrejanjeStan = 0;
PPS = 0;
}
//---[ proracun Rent ]---
if(PlayerInfo[i][pPhousekey] != 255)
{
Rent = HouseInfo[PlayerInfo[i][pPhousekey]][hRent];
if(strcmp(playername, HouseInfo[PlayerInfo[i][pPhousekey]][hOwner], true) == 0)
{
Rent = 0;
}
else if(Rent > GetPlayerMoney(i))
{
PlayerInfo[i][pPhousekey] = 255;
SendClientMessage(i, COLOR_WHITE, "{FF0033}Iseljeni ste !!!");
Rent = 0;
}
HouseInfo[PlayerInfo[i][pPhousekey]][hTakings] = HouseInfo[PlayerInfo[i][pPhousekey]][hTakings]+Rent;
}
//---[ proracun Porez na imovinu i skidanje / obavestavanje o registraciji vozila ]---
new carkey  = PlayerInfo[i][pPcarkey];
if (PlayerInfo[i][pPcarkey]  != 999)
{
if(CarInfo[carkey][cRegistracija] > 0)
{
CarInfo[carkey][cRegistracija] -= 1;
}
if(CarInfo[carkey][cRegistracija] == 0)
{
SendClientMessage(i, COLOR_WHITE, "{FF0033}Istekla vam je registracija vozila 1 !!!");
}
PPV = 150;
}

new carkey2 = PlayerInfo[i][pPcarkey2];
if(PlayerInfo[i][pPcarkey2] != 999)
{
if(CarInfo[carkey2][cRegistracija] > 0)
{
CarInfo[carkey2][cRegistracija] -= 1;
}
if(CarInfo[carkey2][cRegistracija] == 0)
{
SendClientMessage(i, COLOR_WHITE, "{FF0033}Istekla vam je registracija vozila 2 !!!");
}
PPV += 110;
}
new carkey3 = PlayerInfo[i][pPcarkey3];
if(PlayerInfo[i][pPcarkey3] != 999)
{
if(CarInfo[carkey3][cRegistracija] > 0)
{
CarInfo[carkey3][cRegistracija] -= 1;
}
if(CarInfo[carkey3][cRegistracija] == 0)
{
SendClientMessage(i, COLOR_WHITE, "{FF0033}Istekla vam je registracija vozila 3 !!!");
}
PPV += 80;
}
PP = PPK + PPS + PPV;
//----[ proracun kredit ukupno ,rata i kamata ]---
if (PlayerInfo[i][pKredit] > 1)
{
        KreditUK = PlayerInfo[i][pKredit];
        KreditR  = PlayerInfo[i][pKredit]/10;
        KreditK  = KreditR/10;
        PlayerInfo[i][pKredit] = PlayerInfo[i][pKredit]/10;
}
  else
  {
        KreditUK = 0;
        KreditR  = 0;
        KreditK  = 0;
}
//----[ proracun ]---
if(PlayerInfo[i][pDonateRank] >= 3)
{
DonatorKamata = PlayerInfo[i][pAccount]/1000 * 5;
}
if(PlayerInfo[i][pPhousekey] != 255)
{
DonatorKamata = PlayerInfo[i][pAccount]/1000 * 3;
}
else
{
DonatorKamata = PlayerInfo[i][pAccount]/1000 * 1;
}
if(PlayerInfo[i][pDonateRank] > 0)
{
Zaduzenje = VodaKuca+GrejanjeKuca+PPK+VodaStan+GrejanjeStan+Rent+PP+KreditR;
}
else
{
Zaduzenje = StrujaKuca+VodaKuca+GrejanjeKuca+PPK+StrujaStan+VodaStan+GrejanjeStan+PPS+Rent+PP+KreditR+KreditK;
}
NS = PlayerInfo[i][pAccount]-Zaduzenje+DonatorKamata;
//----[ Provera Osiguranja ]---
if(PlayerInfo[i][Osiguranje] > 0)
{
PlayerInfo[i][Osiguranje] --;
}
if(PlayerInfo[i][pOrgVreme] > 0)
{
PlayerInfo[i][pOrgVreme] --;
}
//---[Provera PD Test Vreme]---
if(PlayerInfo[i][pPDVreme] != 0)
{
PlayerInfo[i][pPDVreme] --;
}
if (PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1 || PlayerInfo[i][pMember] == 2 || PlayerInfo[i][pLeader] == 2
|| PlayerInfo[i][pMember] == 3 || PlayerInfo[i][pLeader] == 3 || PlayerInfo[i][pMember] == 4 || PlayerInfo[i][pLeader] == 4
       || PlayerInfo[i][pMember] == 9 || PlayerInfo[i][pLeader] == 9)
{
GivePlayerMoney(i, 500);
SendClientMessage(i, COLOR_WHITE, "{0080C0}[Drzava]{FFFFFF} Vi ste clan drzavne organizacije i primili ste platu od 500$.");
}
if(PlayerInfo[i][pLeader] == 7 || PlayerInfo[i][pMember] == 7)
{
GivePlayerMoney(i, 2000);
SendClientMessage(i, COLOR_WHITE, "{0080C0}[Drzava]{FFFFFF} Vi ste clan vlade primili ste platu od 2000$.");
}
if(PlayerInfo[i][pAdmin] >= 1 || PlayerInfo[i][pGm] >= 1)
{
GivePlayerMoney(i, 2000);
SendClientMessage(i, COLOR_WHITE, "{0080C0}[Administracija]{FFFFFF} Vi ste clan administracije {FF0000}Umbrella Roleplay {FFFFFF}servera, primili ste platu od 2000$.");
}
//---[ sredjivanje datoteka ]---
new SS = PlayerInfo[i][pAccount];
PlayerInfo[i][pAccount] = NS;
PlayerInfo[i][pPayDay] = 0;
PlayerInfo[i][pConnectTime] += 1;
PlayerInfo[i][pExp] +=1; // raspecti
PlayerInfo[i][pAccount] += PlayerInfo[i][pPayCheck];
PlayerInfo[i][pPayCheck] = 0;
BonusNovac[i] += 1;
new godina, mesec,dan;
    getdate(godina, mesec, dan);
    if(PlayerInfo[i][pFishes] > 5)
    {
    PlayerInfo[i][pFishes] --;
    }
if(mesec == 4)
{
    if(dan == 20 || dan == 27)
{
    PlayerInfo[i][pExp] +=1;
SendClientMessage(i, COLOR_WHITE, "{FF0000}[Vikend Akcija] {FFFFFF}Danas vikend akcija, dobili ste dupli respekt.");
}
}
if(mesec == 5)
{
    if(dan == 4 || dan == 11 || dan == 18 || dan == 25)
{
        PlayerInfo[i][pExp] +=1;
SendClientMessage(i, COLOR_WHITE, "{FF0000}[Vikend Akcija] {FFFFFF}Danas je vikend akcija, dobili ste dupli respekt.");
}
}
if(BonusNovac[i] == 6)
{
    GivePlayerMoney(i, 15000);
    BonusNovac[i] = 0;
    GameTextForPlayer(i, "~r~BONUS 25000$", 3000, 4);
    SendClientMessage(i, COLOR_WHITE, "{FF0000}[BONUS] {FFFFFF}Dobili ste bonus od 15000$ zato sto niste napustili igru 6.");

}
if(PlayerInfo[i][pConnectTime] == 5)
{
    GivePlayerMoney(i, 15000);
    SendClientMessage(i, COLOR_WHITE, "{0080C0}[Server] {FFFFFF}Vi ste napunili 5h igre na serveru i kao nagrau ste dobili 15000$. Uzivajte u igri.");
}
if(PlayerInfo[i][pDonateRank] >= 4)
{
PlayerInfo[i][pExp] +=1; // raspecti
}
if(FarmerVar[i] == 0)
{
FarmerPickup[i][0] = 0;
}
Rent = 0;
PlayerInfo[i][pPlata] = 0;
if(GetPlayerMoney(i) < 0)
{
    if(MoneyMessage[i]==0)
    {
    format(string, sizeof(string), "U dugovima ste, imate vremena do sledece provjere da skupite: %d$ ili idete u zatvor.", GetPlayerMoney(i));
SendClientMessage(i, COLOR_LIGHTRED, string);
MoneyMessage[i] = 1;
}
}
if(PlayerInfo[i][pAccount] < 0)
{
    if(MoneyMessageBanka[i]==0)
    {
    format(string, sizeof(string), "[BANKA] {FFFFFF}Vas bankarski racu je u dugu, imate vremena do sledece provjere da skupite: $%d ili idete u zatvor.", PlayerInfo[i][pAccount]);
SendClientMessage(i, COLOR_LIGHTRED, string);
MoneyMessageBanka[i] = 1;
}
}
//---[ ispis PLATE ]---
new clickstring[800];
new msgbox[800];
msgbox="{CC0000}Struja kuca{FFFF00}\t\t%d\n{CC0000}Voda kuca{FFFF00}\t\t%d\n{CC0000}Grejanje kuca{FFFF00}\t\t%d\n{CC0000}Struja stan{FFFF00}\t\t%d\n{CC0000}Voda stan{FFFF00}\t\t%d\n{CC0000}Grejanje stan{FFFF00}\t\t%d\n{CC0000}Rent{FFFF00}\t\t\t%d\n{CC0000}Porez{FFFF00}\t\t\t%d\n{CC0000}Kredit ukupan{FFFF00}\t\t%d\n{CC0000}Kredit rata{FFFF00}\t\t%d\n{CC0000}Kredit kamata{FFFF00}\t\t%d\n\n{CC0000}Banka{FFFF00}\t\t\t%d\n{CC0000}Zaduzenje{FFFF00}\t\t%d\n\n{CC0000}Novo stanje{FFFF00}\t\t%d";
format(clickstring,sizeof clickstring,msgbox, StrujaKuca, VodaKuca, GrejanjeKuca, StrujaStan, VodaStan, GrejanjeStan, Rent, PP, KreditUK, KreditR, KreditK, SS, Zaduzenje, NS);
ShowPlayerDialog(i,PLATAI,DIALOG_STYLE_MSGBOX,"Izrada racuna :",clickstring,"Uredu","Uredu");
OnPropUpdate();
print("Kraj plate");
OnPlayerUpdateCustom(i);
}
else
{
PlayerInfo[i][pPlata] = 0;
    SendClientMessage(i, COLOR_WHITE, "* Niste igrali dovoljno dugo da biste dobili racune.");
    print("pr nedovolno u");
}

}
print("Plata");
SaveAccounts();
return 1;
}

Probaj 'vako.
A jel imas SetTime(3600, true); ... ?

public SyncTime()
{
new string[256];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
if ((tmphour > ghour) || (tmphour == 1 && ghour == 23))
{
format(string, sizeof(string), "{FF0000}UC{FFFFFF}:{FF0000}HP {FFFFFF}Sada je {FF0000}%d:00 {FFFFFF}sati.",tmphour);
BroadCast(COLOR_WHITE,string);
PokreniLoto();
PayDay();
ghour = tmphour;
if(realtime)
{
SetWorldTime(tmphour+1);
}
}
}

Citat: Vitez El arambasa poslato Avgust 09, 2013, 14:42:58 POSLE PODNE
Probaj 'vako.
A jel imas SetTime(3600, true); ... ?

public SyncTime()
{
new string[256];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
if ((tmphour > ghour) || (tmphour == 1 && ghour == 23))
{
format(string, sizeof(string), "{FF0000}UC{FFFFFF}:{FF0000}HP {FFFFFF}Sada je {FF0000}%d:00 {FFFFFF}sati.",tmphour);
BroadCast(COLOR_WHITE,string);
PokreniLoto();
PayDay();
ghour = tmphour;
if(realtime)
{
SetWorldTime(tmphour+1);
}
}
}


Sta lupas 3600? 3600 je 3.6 sekundi tad bi stvaralo lag i crashove, stavi na 3600000
RESPECT: Blaeks, Yui_Sang, Gagi, Kapetan Husein, Luksa, Slay, Denis_Lapi, Zoran(Dude)

Programski jezici koje koristim: C, C#, Visual Basic, HTML, CSS, PHP (tek ucim).


Citat: |LZ| Bugi poslato Avgust 09, 2013, 15:11:02 POSLE PODNE
Citat: Vitez El arambasa poslato Avgust 09, 2013, 14:42:58 POSLE PODNE
Probaj 'vako.
A jel imas SetTime(3600, true); ... ?

public SyncTime()
{
new string[256];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
if ((tmphour > ghour) || (tmphour == 1 && ghour == 23))
{
format(string, sizeof(string), "{FF0000}UC{FFFFFF}:{FF0000}HP {FFFFFF}Sada je {FF0000}%d:00 {FFFFFF}sati.",tmphour);
BroadCast(COLOR_WHITE,string);
PokreniLoto();
PayDay();
ghour = tmphour;
if(realtime)
{
SetWorldTime(tmphour+1);
}
}
}


Sta lupas 3600? 3600 je 3.6 sekundi tad bi stvaralo lag i crashove, stavi na 3600000

znam da je 3.6 sekundi , nego sam to na brzinu pisao , jer sam naviko u sampu da bude 3600 u zatvoru ili tako to a znam da se povecava za 3 nule uvek , valjda je on shvatio

to je gf skripta, tu se ne mota tajmer na svakih sat vreemna zato sto to zavisi od igracevog logovanja, daj sve vezano za tu platu


tu je sve okej, sta ti pokrece tu funkciju synctime ?

Citat: Blaeks poslato Avgust 09, 2013, 17:07:09 POSLE PODNE
tu je sve okej, sta ti pokrece tu funkciju synctime ?
forward SyncTime();
public SyncUp()
{
SyncTime();
DollahScoreUpdate();
}

if(strcmp(cmd, "/plata", true) == 0)//By: Petricko
{
    if(IsPlayerConnected(playerid))
    {
  if(PlayerInfo[playerid][pAdmin] >= 1339 )
{
SetTimer("SyncTime", 1000, 0);
SendClientMessage(playerid, COLOR_WHITE, "plata pokrenuta");
}
    }
    return 1;
}

public SyncTime()
{
new string[256];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
FixHour(tmphour);
tmphour = shifthour;
if ((tmphour > ghour) || (tmphour == 1 && ghour == 23))
{
format(string, sizeof(string), "{FF0000}UC{FFFFFF}:{FF0000}HP {FFFFFF}Sada je {FF0000}%d:00 {FFFFFF}sati.",tmphour);
BroadCast(COLOR_WHITE,string);
PokreniLoto();
PayDay();
ghour = tmphour;
if(realtime)
{
SetWorldTime(tmphour+1);
}
}
}


to je sve SyncTime

a ovaj sync up ? sta njega pokrece ?

Citat: Blaeks poslato Avgust 09, 2013, 17:25:31 POSLE PODNE
a ovaj sync up ? sta njega pokrece ?
ProveraPlater = SetTimer("SyncUp", 60000, 1);