new Kamat[MAX_PLAYERS];Kamat = Player[playerid][pASD]/10; //Pl: Jatekos penze :10.000$/Kamat lesz:1.000$
#define egyperc 60*1000SetTimerEx(\"Kamatolj\",15*egyperc,0,\"i\",playerid);
forward Kamatolj(playerid);public Kamatolj(playerid) { Player[playerid][pASD] += Kamat; return 1;}
#include <a_samp>#include <zcmd>#include <sscanf2>#include <Dini>#define egyperc 60*1000new Kamat[MAX_PLAYERS];#pragma tabsize 0enum pInfo{pASD};new Player[MAX_PLAYERS][pInfo];new mentes[128];new bool:belepve[MAX_PLAYERS];public OnPlayerDisconnect(playerid, reason){ if(belepve[playerid]==true) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(mentes,sizeof(mentes),\"Bank/%s.ini\",name); dini_Create(mentes); dini_IntSet(mentes,\"Penz\",Player[playerid][pASD]); } belepve[playerid]=false; return 1;} CMD:betesz(playerid,params[]){ if(GetPlayerMoney(playerid)<1)return SendClientMessage(playerid,-1,\"Nincs nálad pénz.\"); new mennyit; if(sscanf(params,\"d\",mennyit))return SendClientMessage(playerid,-1,\"Használat: /Betesz <mennyit>\"); if(mennyit<1)return SendClientMessage(playerid,-1,\"Minimum 1.\"); if(mennyit>GetPlayerMoney(playerid))return SendClientMessage(playerid,-1,\"Nincs nálad ennyi.\"); Player[playerid][pASD]+=mennyit; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(mentes,sizeof(mentes),\"Bank/%s.ini\",name); dini_IntSet(mentes,\"Penz\",Player[playerid][pASD]); SendClientMessage(playerid,-1,\"Betetél pénzt a bankba.\"); GivePlayerMoney(playerid,-mennyit); return 1;} CMD:kivesz(playerid,params[]){ new mennyit; if(sscanf(params,\"d\",mennyit))return SendClientMessage(playerid,-1,\"Használat: /Kivesz <mennyit>\"); if(Player[playerid][pASD]<mennyit)return SendClientMessage(playerid,-1,\"Nincs ennyi pénzed.\"); if(mennyit<1)return SendClientMessage(playerid,-1,\"Minimum 1\"); Player[playerid][pASD]-=mennyit; GivePlayerMoney(playerid,mennyit); new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(mentes,sizeof(mentes),\"Bank/%s.ini\",name); dini_IntSet(mentes,\"Penz\",Player[playerid][pASD]); SendClientMessage(playerid,-1,\"Kivettél pénzt a bankból\"); return 1;}public OnPlayerConnect(playerid) { SetTimerEx(\"Kamatolj\",15*egyperc,0,\"i\",playerid); Kamat[playerid] = Player[playerid][pASD]/10; //A kamat = jatekos penzenek az 1/10 ed resze (egytized) return 1;} public OnPlayerSpawn(playerid){ belepve[playerid]=true; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(mentes,sizeof(mentes),\"Bank/%s.ini\",name); Player[playerid][pASD]=dini_Int(mentes,\"Penz\"); return 1;forward Kamatolj(playerid);public Kamatolj(playerid) { Player[playerid][pASD] += Kamat[playerid]; return 1;}}
new kamatstr[50];format(kamatstr, sizeof(kamatstr), \"Kamatod: %d %, Kamat[playerid]);SendClientMessage(playerid, -1, kamatstr);
Kamat[playerid] = Player[playerid][pASD]/10;
forward Kamatolj(playerid);public Kamatolj(playerid) { Kamat[playerid] = Player[playerid][pASD]/10; Player[playerid][pASD] += Kamat[playerid]; return 1;}
new kamatstr[50];format(kamatstr, sizeof(kamatstr), \"Kamatod: %d %, Kamat[playerid]);SendClientMessage(playerid, -1, kamatstr);es akkor igy lessz :forward Kamatolj(playerid);public Kamatolj(playerid) { Kamat[playerid] = Player[playerid][pASD]/10; Player[playerid][pASD] += Kamat[playerid]; new kamatstr[50]; format(kamatstr, sizeof(kamatstr), \"Kamatod: %d %, Kamat[playerid]); SendClientMessage(playerid, -1, kamatstr); return 1;}
Kamat[playerid] = Player[playerid][pASD]/10; ^ - ezt a szamot modositot(10 et) es annyival osztja el
Itt van.Ki irja mennyi kamatot kaptal: new kamatstr[50];format(kamatstr, sizeof(kamatstr), \"Kamatod: %d %, Kamat[playerid]);SendClientMessage(playerid, -1, kamatstr); Meg csinalhatod ugy is hogy egy kamatot adjon mindenkinek.(mindenki 2000$-t kap percenkent)Viszont ha ugy csinalod ahogy en csinaltam, akkor kiszamitja a jatekos bankban levo penzenek a 10% at, es annyit ad hozza + ba percenkent.Am ott is hibaztam:Kamat[playerid] = Player[playerid][pASD]/10; ezt is a public Kamatolj ala rakd.Igy: forward Kamatolj(playerid);public Kamatolj(playerid) { Kamat[playerid] = Player[playerid][pASD]/10; Player[playerid][pASD] += Kamat[playerid]; return 1;} Ha azt akarod hogy 15 percenkent irja ki a kamatot, akkor ezt is berakod a kamatolj ala: new kamatstr[50];format(kamatstr, sizeof(kamatstr), \"Kamatod: %d %, Kamat[playerid]);SendClientMessage(playerid, -1, kamatstr);es akkor igy lessz :forward Kamatolj(playerid);public Kamatolj(playerid) { Kamat[playerid] = Player[playerid][pASD]/10; Player[playerid][pASD] += Kamat[playerid]; new kamatstr[50]; format(kamatstr, sizeof(kamatstr), \"Kamatod: %d %, Kamat[playerid]); SendClientMessage(playerid, -1, kamatstr); return 1;} Am ha a kamatot akarod allitani akkor Kamat[playerid] = Player[playerid][pASD]/10; ^ - ezt a szamot modositot(10 et) es annyival osztja el