Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <sscanf2>
- #include <zcmd>
- #include <dini>
- #define COLOR_GREY 0x808080FF
- #define SERVER_VOUCHER_FILE "vouchers/%d.ini"
- new fstring[32], nstring[156];
- public OnFilterScriptInit()
- {
- print("\n------------------------");
- print(" JG-ZM Fix Bug");
- print("------------------------\n");
- return 1;
- }
- CMD:genvoucher(playerid, params[])
- {
- new code, pexp, score;
- code = random(9999999);
- if(sscanf(params, "dd", pexp, score))
- {
- return SendClientMessage(playerid, COLOR_GREY, "USAGE: /genvoucher <money> <score>");
- }
- if(IsPlayerAdmin(playerid))
- {
- format(fstring, sizeof(fstring), SERVER_VOUCHER_FILE, code);
- if(dini_Exists(fstring)) return SendClientMessage(playerid, COLOR_GREY, "Voucher dibuat sudah ada");
- dini_Create(fstring);
- dini_IntSet(string, "pexp", pexp);
- dini_IntSet(string, "Score", score);
- format(nstring, sizeof(nstring), "SUCCES: Voucher '%d' berhasil membuat.ERROR: Voucher dibuat sudah ada.", code);
- SendClientMessage(playerid, COLOR_GREY, nstring);
- }
- return 1;
- }
- CMD:addvoucher(playerid, params[])
- {
- new code, pexp, score;
- if(sscanf(params, "ddd", code, pexp, score))
- {
- return SendClientMessage(playerid, COLOR_GREY, "USAGE: /addvoucher <code> <money> <score>");
- }
- if(IsPlayerAdmin(playerid))
- {
- format(fstring, sizeof(fstring), SERVER_VOUCHER_FILE, code);
- if(dini_Exists(fstring)) return SendClientMessage(playerid, COLOR_GREY, "ERROR: Voucher dibuat sudah ada.");
- dini_Create(fstring);
- dini_IntSet(string, "pexp", pexp);
- dini_IntSet(string, "Score", score);
- format(nstring, sizeof(nstring), "SUCCES: Voucher '%d' berhasil membuat.", code);
- SendClientMessage(playerid, COLOR_GREY, nstring);
- }
- return 1;
- }
- CMD:savoucher(playerid, params[])
- {
- new pexp, score;
- if(sscanf(params, "dd", pexp, score))
- {
- return SendClientMessage(playerid, COLOR_GREY, "USAGE: /savoucher <money> <score>");
- }
- if(IsPlayerAdmin(playerid))
- {
- for(new i; i <= 9999999; i++)
- {
- format(fstring, sizeof(fstring), SERVER_VOUCHER_FILE, i);
- if(!dini_Exists(fstring))
- {
- dini_Create(fstring);
- dini_IntSet(string, "pexp", pexp);
- dini_IntSet(string, "Score", score);
- format(nstring, sizeof(nstring), "SUCCES: Voucher '%d' Berhasil Di Buat.", i);
- SendClientMessage(playerid, COLOR_GREY, nstring);
- return 1;
- }
- }
- }
- return 1;
- }
- CMD:voucher(playerid, params[])
- {
- new code;
- if(sscanf(params, "d", code))
- {
- SendClientMessage(playerid, COLOR_GREY, "USAGE: /voucher <code>");
- return 1;
- }
- format(fstring, sizeof(fstring), SERVER_VOUCHER_FILE, code);
- if(dini_Exists(fstring))
- {
- GivePlayerXP(playerid, dini_Int(fstring, "pexp"));
- SetPlayerScore(playerid, GetPlayerScore(playerid)+dini_Int(fstring, "Score"));
- format(nstring, sizeof(nstring), "SUCCES: Anda menerima $%d exp dan %d Score.", dini_Int(fstring, "vMoney"), dini_Int(fstring, "vScore"));
- SendClientMessage(playerid, COLOR_GREY, nstring);
- dini_Remove(fstring);
- } else {
- SendClientMessage(playerid, COLOR_GREY, "ERROR: Voucher ini tidak ada!");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement