Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined Coins SYStem
- ______________________________________________________________________________
- | |]SPEED[|'s Productions Present:D |
- | xxSPEEDYxx's Coins System - Gold Coins, Silver Coins, Bronze Coins |
- | v1.0 |
- |v1.0 [initial relase] |
- | --> Foloseste /coinshelp pentru a vedea comenzile cu coins |
- | |
- |!!!Va rog nu stergeti creditele!!! |
- |_____________________________________________________________________________|
- #endif
- #include < a_samp >
- #include < dini >
- #include < zcmd >
- #include < sscanf >
- #define PlayerFile "Coins/%s.ini"
- #define MyCoins (12000)
- #define CH (12001)
- #define BOX (DIALOG_STYLE_MSGBOX)
- #define RED (0xE60000AA)
- #define GREEN (0x8CE46CAA)
- #define YELLOW (0xFFFF00AA)
- #define BLUE (0x0000BBAA)
- #pragma tabsize 0
- enum PLAYER_COINS
- {
- GoldCoins,
- SilverCoins,
- BronzeCoins
- };
- new giveplayerid, amount1, amount2, amount3;
- new PlayerInfo[MAX_PLAYERS][PLAYER_COINS];
- new sstring[ 256 ];
- new Global_Name[MAX_PLAYER_NAME];
- public OnPlayerConnect(playerid)
- {
- new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
- if(!dini_Exists(file)) {
- dini_Create(file);
- dini_IntSet(file,"GoldCoins:", PlayerInfo[playerid][GoldCoins]);
- dini_IntSet(file,"SilverCoins:", PlayerInfo[playerid][SilverCoins]);
- dini_IntSet(file,"BronzeCoins:", PlayerInfo[playerid][BronzeCoins]);
- }
- PlayerInfo[playerid][GoldCoins] = dini_Int(file,"GoldCoins:");
- PlayerInfo[playerid][SilverCoins] = dini_Int(file,"SilverCoins:");
- PlayerInfo[playerid][BronzeCoins] = dini_Int(file,"BronzeCoins:");
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
- dini_IntSet(file,"GoldCoins:", PlayerInfo[playerid][GoldCoins]);
- dini_IntSet(file,"SilverCoins:", PlayerInfo[playerid][SilverCoins]);
- dini_IntSet(file,"BronzeCoins:", PlayerInfo[playerid][BronzeCoins]);
- return 1;
- }
- CMD:coinshelp(playerid, params[])
- {
- new str[ 256 ];
- strcat(str,"Use /givegcoins for give gold coins to a player!");
- strcat(str,"Use /givescoins for give silver coins to a player!");
- strcat(str,"Use /givebcoins for give bronze coins to a player!");
- strcat(str,"Use /setgcoins (only for admins) for set gold coins to a player.");
- strcat(str,"Use /setscoins (only for admins) for set silver coins to a player.");
- strcat(str,"Use /setbcoins (only for admins) for set bronze coins to a player.");
- strcat(str,"Use /mycoins for see your amount of: Gold,Silver,Bronze coins.");
- strcat(str,"Use /coinshelp for see the coins commands!");
- ShowPlayerDialog(playerid, CH, BOX, "xxSPEEDYxx's Coins SYstem",str,"Quit","");
- return 1;
- }
- CMD:givegcoins(playerid, params[])
- {
- if(sscanf(params, "ud", giveplayerid, amount1)) return SendClientMessage(playerid, RED, "USAGE: /givegcoins [playerid] [Gold Coins]");
- if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: That player is not connected!");
- if(giveplayerid == playerid) return SendClientMessage(playerid, RED, "ERROR: You cant send yourself coins!");
- if(amount1 > PlayerInfo[playerid][GoldCoins]) return SendClientMessage(playerid, RED, "ERROR: You dont have that amount of gold coins!");
- new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(giveplayerid, Global_Name, sizeof(Global_Name));GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
- format(sstring, sizeof(sstring), "You have succesfully sent %d gold coins to %s(%d)!", amount1, Global_Name, playerid);
- SendClientMessage(playerid, YELLOW, sstring);
- format(sstring, sizeof(sstring), "%s(%d) has given to you %d amount of gold coins!", Name, playerid, amount1);
- SendClientMessage(giveplayerid, YELLOW, sstring);
- PlayerInfo[giveplayerid][GoldCoins] += amount1;
- PlayerInfo[playerid][GoldCoins] -= amount1;
- dini_IntSet(file,"GoldCoins:", PlayerInfo[giveplayerid][GoldCoins]);
- dini_IntSet(file,"GoldCoins:", PlayerInfo[playerid][GoldCoins]);
- return 1;
- }
- CMD:givescoins(playerid, params[])
- {
- if(sscanf(params, "ud", giveplayerid, amount2)) return SendClientMessage(playerid, RED, "USAGE: /givescoins [playerid] [Silver Coins]");
- if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: That player is not connected!");
- if(giveplayerid == playerid) return SendClientMessage(playerid, RED, "ERROR: You cant send yourself coins!");
- if(amount2 > PlayerInfo[playerid][SilverCoins]) return SendClientMessage(playerid, RED, "ERROR: You dont have that amount of silver coins!");
- new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(giveplayerid, Global_Name, sizeof(Global_Name));GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
- format(sstring, sizeof(sstring), "You have succesfully sent %d gold coins to %s(%d)!", amount2, Global_Name, playerid);
- SendClientMessage(playerid, YELLOW, sstring);
- format(sstring, sizeof(sstring), "%s(%d) has given to you %d amount of gold coins!", Name, playerid, amount2);
- SendClientMessage(giveplayerid, YELLOW, sstring);
- PlayerInfo[giveplayerid][SilverCoins] += amount2;
- PlayerInfo[playerid][SilverCoins] -= amount2;
- dini_IntSet(file,"SilverCoins:", PlayerInfo[giveplayerid][SilverCoins]);
- dini_IntSet(file,"SilverCoins:", PlayerInfo[playerid][SilverCoins]);
- return 1;
- }
- CMD:givebcoins(playerid, params[])
- {
- if(sscanf(params, "ud", giveplayerid, amount3)) return SendClientMessage(playerid, RED, "USAGE: /giveboins [playerid] [Bronze Coins]");
- if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: That player is not connected!");
- if(giveplayerid == playerid) return SendClientMessage(playerid, RED, "ERROR: You cant send yourself coins!");
- if(amount2 > PlayerInfo[playerid][GoldCoins]) return SendClientMessage(playerid, RED, "ERROR: You dont have that amount of gold coins!");
- new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(giveplayerid, Global_Name, sizeof(Global_Name));GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
- format(sstring, sizeof(sstring), "You have succesfully sent %d bronze coins to %s(%d)!", amount3, Global_Name, playerid);
- SendClientMessage(playerid, YELLOW, sstring);
- format(sstring, sizeof(sstring), "%s(%d) has given to you %d amount of bronze coins!", Name, playerid, amount3);
- SendClientMessage(giveplayerid, YELLOW, sstring);
- PlayerInfo[giveplayerid][BronzeCoins] += amount3;
- PlayerInfo[playerid][BronzeCoins] -= amount3;
- dini_IntSet(file,"BronzeCoins:", PlayerInfo[giveplayerid][BronzeCoins]);
- dini_IntSet(file,"BronzeCoins:", PlayerInfo[playerid][BronzeCoins]);
- return 1;
- }
- CMD:mycoins(playerid, params[])
- {
- format(sstring, sizeof(sstring), "\tHi, %s i will show you your amount of coins!\n\nYou Have: %d Gold Coins!\nYou Have: %d Silver Coins!\nYou Have: %d Bronze Coins!", Global_Name, PlayerInfo[playerid][GoldCoins], PlayerInfo[playerid][SilverCoins], PlayerInfo[playerid][BronzeCoins]);
- ShowPlayerDialog(playerid, MyCoins, BOX,"Info Coins",sstring,"Quit","");
- return 1;
- }
- CMD:setgcoins(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid, RED, "ERROR: Only admins can use that command!");
- if(sscanf(params, "ud", giveplayerid, amount1)) return SendClientMessage(playerid, RED, "USAGE: /givecoins [playerid] [Gold Coins]");
- if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: That player is not connected!");
- new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(giveplayerid, Global_Name, sizeof(Global_Name));GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
- format(sstring, sizeof(sstring), "You have succesfully setted %s gold coins to %d!", Global_Name, amount1);
- SendClientMessage(playerid, BLUE, sstring);
- format(sstring, sizeof(sstring), "Admin %s has setted your gold coins to %d!", Name, amount1);
- SendClientMessage(giveplayerid, BLUE, sstring);
- PlayerInfo[giveplayerid][GoldCoins] = amount1;
- dini_IntSet(file,"GoldCoins:", PlayerInfo[giveplayerid][GoldCoins]);
- return 1;
- }
- CMD:setscoins(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid, RED, "ERROR: Only admins can use that command!");
- if(sscanf(params, "ud", giveplayerid, amount1)) return SendClientMessage(playerid, RED, "USAGE: /givecoins [playerid] [Silver Coins]");
- if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: That player is not connected!");
- new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(giveplayerid, Global_Name, sizeof(Global_Name));GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
- format(sstring, sizeof(sstring), "You have succesfully setted %s silver coins to %d!", Global_Name, amount2);
- SendClientMessage(playerid, BLUE, sstring);
- format(sstring, sizeof(sstring), "Admin %s has setted your silver coins to %d!", Name, amount2);
- SendClientMessage(giveplayerid, BLUE, sstring);
- PlayerInfo[giveplayerid][SilverCoins] = amount2;
- dini_IntSet(file,"SilverCoins:", PlayerInfo[giveplayerid][SilverCoins]);
- return 1;
- }
- CMD:setbcoins(playerid, params[])
- {
- if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid, RED, "ERROR: Only admins can use that command!");
- if(sscanf(params, "ud", giveplayerid, amount1)) return SendClientMessage(playerid, RED, "USAGE: /givecoins [playerid] [Bronze Coins]");
- if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: That player is not connected!");
- new file[100],Name[MAX_PLAYER_NAME],Ip[16]; GetPlayerName(giveplayerid, Global_Name, sizeof(Global_Name));GetPlayerName(playerid,Name,sizeof(Name)); GetPlayerIp(playerid,Ip,sizeof(Ip)); format(file,sizeof(file),PlayerFile,Name);
- format(sstring, sizeof(sstring), "You have succesfully setted %s coins to %d!", Global_Name, amount3);
- SendClientMessage(playerid, BLUE, sstring);
- format(sstring, sizeof(sstring), "Admin %s has setted your bronze coins to %d!", Name, amount3);
- SendClientMessage(giveplayerid, BLUE, sstring);
- PlayerInfo[giveplayerid][GoldCoins] = amount3;
- dini_IntSet(file,"BronzeCoins:", PlayerInfo[giveplayerid][BronzeCoins]);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement