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>
- #include <CheckpointManager>
- #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
- #define BUYING 1
- #define FIRSTMENU 500
- public OnFilterScriptInit()
- {
- // ******************************* [ Pick ups] *********************************
- // |--------------------------------------------------------------------------|*
- // |*
- // |*
- // |*
- // |--------------------------------------------------------------------------|*
- // *****************************************************************************
- // ***************************** [ Checkpoints ] *******************************
- // |--------------------------------------------------------------------------|*
- // |*
- CreateCheckpoint(GLOBAL_OWNER_ID, BUYING, // |*
- 1717.9043, -1628.7946, 20.2077); // |*
- // |*
- // |*
- // |*
- // |*
- // |*
- StartCheckpointSeeking(); // |*
- // |*
- // |--------------------------------------------------------------------------|*
- // *****************************************************************************
- 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]);
- INI_Int("Tokens:", PlayerInfo[playerid][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.~n~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:", PlayerInfo[TarID][ptokens]);
- 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: /give [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 %d Tokens.", GetPlayerNameEx(TarID), amount);
- SendClientMessage(playerid, COLOR_GRAD2, string);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You don't have that much!");
- }
- 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;
- }
- 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 OnPlayerEnterCheckpoint(playerid)
- {
- VerifyCheckpoint(playerid); //Asks the CpMngr to check this cp
- return 1;
- }
- public OnCheckpointEnter(playerid, checkpointid)
- {
- switch(checkpointid)
- {
- case BUYING:
- {
- ShowPlayerDialog(playerid, FIRSTMENU, DIALOG_STYLE_LIST,
- "Regular Players Lounge",
- "MP5\nShotgun\nDesert Eagle\nCombat Shotgun\nM4\nAK-47\nSniper Rifle",
- "Select", "Exit");
- }
- }
- 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);
- 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 == 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment