Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #include <YSI\y_ini>
- #include <zcmd>
- #include <sscanf2>
- #define PATH "/Tokens/%s.ini"
- #define COLOR_RED 0xAA3333AA
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_RED 0xAA3333AA
- #include <a_zones>
- #include <streamer>
- #include <foreach>
- #include <progress>
- #include <YSI/y_timers.inc>
- #include <yom_buttons>
- #include <audio>
- #define FIRSTMENU 400
- public OnFilterScriptInit()
- {
- // ******************************* [ Pick ups] *********************************
- // |--------------------------------------------------------------------------|* // |*
- // |*
- // |*
- // |--------------------------------------------------------------------------|*
- // *****************************************************************************
- // ***************************** [ Checkpoints ] *******************************
- // |--------------------------------------------------------------------------|*
- // |*
- // |*
- // |*
- // |*
- // |*
- // |*
- // |* // |* // |*
- // |--------------------------------------------------------------------------|*
- // *****************************************************************************
- return 1;
- }
- stock GetPlayerNameEx(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- enum pData
- {
- ptokens
- }
- new PlayerInfo[MAX_PLAYERS + 1][pData];
- forward LoadUser_Data(playerid,TarID,name[],value[]);
- public LoadUser_Data(playerid,TarID,name[],value[])
- {
- INI_Int("Tokens:", PlayerInfo[TarID][ptokens]);
- return 1;
- }
- stock UserPath(TarID)
- {
- new string[128],pName[MAX_PLAYER_NAME];
- GetPlayerName(TarID,pName,MAX_PLAYER_NAME);
- format(string,sizeof(string),PATH,pName);
- return string;
- }
- COMMAND:settokens(playerid, params[])
- {
- new TarID, amount;
- if(sscanf(params,"ui",TarID,amount)) return SendClientMessage(playerid,COLOR_RED,"Syntax: [Playerid] [tokens]");
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You're not authorized to use this command");
- if(!IsPlayerConnected(TarID)) return SendClientMessage(playerid,COLOR_RED,"Check your entry.Player is not Connected to the game");
- new currentok = PlayerInfo[TarID][ptokens];
- PlayerInfo[TarID][ptokens] = currentok + amount;
- new INI:File = INI_Open(UserPath(TarID));
- INI_SetTag(File, "VIP Tokens");
- INI_WriteInt(File,"Tokens:", currentok + amount);
- INI_Close(File);
- return 1;
- }
- COMMAND:givetokens(playerid, params[])
- {
- new string[128], TarID, amount;
- if(sscanf(params, "us[32]d", TarID, amount))
- {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givetokens [playerid/partofname] [amount]");
- return 1;
- }
- if(TarID == playerid)
- {
- SendClientMessage(playerid, COLOR_GREY, "You can't use this command on yourself!");
- return 1;
- }
- if(PlayerInfo[playerid][ptokens] >= amount)
- {
- PlayerInfo[TarID][ptokens] += amount;
- PlayerInfo[playerid][ptokens] -= amount;
- format(string, sizeof(string), "You have recieved %d Tokens from %s.", amount, GetPlayerNameEx(playerid));
- SendClientMessage(TarID, COLOR_GRAD2, string);
- format(string, sizeof(string), "You have given %s Tokens To %d.", amount, GetPlayerNameEx(TarID));
- SendClientMessage(playerid, COLOR_GRAD2, string);
- }
- if(PlayerInfo[playerid][ptokens] < amount)
- {
- SendClientMessage(playerid, COLOR_GREY, "You don't have that much!");
- }
- return 1;
- }
- COMMAND:checktokens(playerid, params[])
- {
- new string[128];
- new currentok = PlayerInfo[playerid][ptokens];
- format(string, sizeof(string), "You have currently %d Tokens ", currentok);
- SendClientMessage(playerid, COLOR_GRAD2, string);
- return 1;
- }
- forward OnPlayerConnect(playerid);
- public OnPlayerConnect(playerid)
- {
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s",.bExtra =true, .extra =playerid);
- }
- else if(!fexist(UserPath(playerid)))
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"VIP Tokens");
- INI_WriteInt(File,"Tokens:", 0);
- INI_Close(File);
- }
- return 1;
- }
- COMMAND:buyweapons(playerid, params[])
- {
- if(IsPlayerConnected(playerid))
- {
- if(IsPlayerInRangeOfPoint(playerid, 3, 1720.9337, -1629.0479, 20.2135))
- {
- ShowPlayerDialog(playerid, FIRSTMENU, DIALOG_STYLE_LIST,
- "Weapons List",
- "MP5 5 Tokens\nShotgun 5 Tokens\nDesert Eagle 5 Tokens\nCombat Shotgun5 Tokens\nM4 5 Tokens\nAK-47 5 Tokens\nSniper Rifle 5 Tokens",
- "Select", "Exit");
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You Are not at the weapon point!");
- }
- }
- return 1;
- }
- forward CheckTokens(playerid);
- public CheckTokens(playerid)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File, "VIP Tokens");
- INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
- INI_Close(File);
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File, "VIP Tokens");
- INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
- INI_Close(File);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == FIRSTMENU)
- {
- if(response)
- {
- if(listitem == 0) // MP5
- {
- if(PlayerInfo[playerid][ptokens] >= 5)
- {
- SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
- PlayerInfo[playerid][ptokens] -= 5;
- GivePlayerWeapon(playerid, 29, 200);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File, "VIP Tokens");
- INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
- INI_Close(File);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
- }
- }
- }
- if(listitem == 1) // Shotgun
- {
- if(PlayerInfo[playerid][ptokens] >= 5)
- {
- SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
- PlayerInfo[playerid][ptokens] -= 5;
- GivePlayerWeapon(playerid, 25, 50);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File, "VIP Tokens");
- INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
- INI_Close(File);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
- }
- }
- }
- if(listitem == 2) // Deagle
- {
- if(PlayerInfo[playerid][ptokens] >= 5)
- {
- SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
- PlayerInfo[playerid][ptokens] -= 5;
- GivePlayerWeapon(playerid, 24, 100);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
- }
- }
- if(listitem == 3) // Combat Shotgun
- {
- if(PlayerInfo[playerid][ptokens] >= 5)
- {
- SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
- PlayerInfo[playerid][ptokens] -= 5;
- GivePlayerWeapon(playerid, 27, 200);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File, "VIP Tokens");
- INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
- INI_Close(File);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
- }
- }
- if(listitem == 4) //M4
- {
- if(PlayerInfo[playerid][ptokens] >= 5)
- {
- SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
- PlayerInfo[playerid][ptokens] -= 5;
- GivePlayerWeapon(playerid, 31, 50);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File, "VIP Tokens");
- INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
- INI_Close(File);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
- }
- }
- if(listitem == 5) // AK
- {
- if(PlayerInfo[playerid][ptokens] >= 5)
- {
- SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
- PlayerInfo[playerid][ptokens] -= 5;
- GivePlayerWeapon(playerid, 30, 200);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File, "VIP Tokens");
- INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
- INI_Close(File);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
- }
- }
- if(listitem == 6) // Sniper
- {
- if(PlayerInfo[playerid][ptokens] >= 5)
- {
- SendClientMessage(playerid, COLOR_GREY,"* Recieved your GUN, HAVE FUN ! ");
- PlayerInfo[playerid][ptokens] -= 5;
- GivePlayerWeapon(playerid, 34, 50);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File, "VIP Tokens");
- INI_WriteInt(File,"Tokens:", PlayerInfo[playerid][ptokens]);
- INI_Close(File);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY,"* You cannot afford this!");
- }
- }
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment