Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=====================
- //**********************Posa/prendi Soldi system by olliver fred************************
- //************************CMDS: /posasoldi, /prendisoldi*************************
- //**********************************;P*********************************************
- //=====================
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- //=====================
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_LIGHTRED 0xFF6347AA
- #define COLOR_LIGHTBLUE 0x006FDD96
- //=====================
- forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- //=====================
- new
- MoneyObject[150];
- //=====================
- enum mInfo
- {
- dType,
- dAmount[2],
- Float:dx,
- Float:dy,
- Float:dz,
- dWorld,
- };
- new MoneyInfo[150][mInfo];
- //=====================
- COMMAND:prendisoldi(playerid, params[])
- {
- new string[64];
- for(new i = 0; i < sizeof(MoneyInfo); i++)
- {
- if (PlayerToPoint(3.0,playerid,MoneyInfo[i][dx],MoneyInfo[i][dy],MoneyInfo[i][dz]))
- {
- if(MoneyInfo[i][dType] == 1)
- {
- format(string, sizeof(string), "INFO: Hai preso $%d da terra.", MoneyInfo[i][dAmount][0]);
- SendClientMessage(playerid,COLOR_GREY, string);
- GivePlayerMoney(playerid, MoneyInfo[i][dAmount][0]);
- MoneyInfo[i][dAmount][0] = 0;
- MoneyInfo[i][dType] = 0;
- DestroyObject(MoneyObject[i]);
- MoneyInfo[i][dx] = 0.0;
- MoneyInfo[i][dy] = 0.0;
- MoneyInfo[i][dz] = 0.0;
- return 1;
- }
- }
- }
- return 1;
- }
- //=====================
- COMMAND:posasoldi(playerid, params[])
- {
- new string[64],ammount;
- if(sscanf(params, "i", ammount)) SendClientMessage(playerid, COLOR_GREY, "USA: /posasoldi [soldi]");
- else
- {
- if(GetPlayerMoney(playerid) >= ammount)
- {
- for(new i = 0; i < sizeof(MoneyInfo); i++)
- {
- if(MoneyInfo[i][dx] == 0.0 && MoneyInfo[i][dy] == 0.0 && MoneyInfo[i][dz] == 0.0)
- {
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- MoneyInfo[i][dType] = 1;
- MoneyInfo[i][dAmount][0] = ammount;
- MoneyInfo[i][dx] = X;
- MoneyInfo[i][dy] = Y;
- MoneyInfo[i][dz] = Z;
- MoneyInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
- MoneyObject[i] = CreateObject(1550, X, Y, Z-1, 0, 0, 0);
- GivePlayerMoney(playerid, -ammount);
- format(string, sizeof(string), "INFO: Hai posato $%d in terra.", ammount);
- SendClientMessage(playerid,COLOR_WHITE, string);
- return 1;
- }
- }
- }
- else
- {
- format(string, sizeof(string), "INFO: Non hai $%d per posarli.", ammount);
- SendClientMessage(playerid,COLOR_LIGHTRED, string);
- }
- }
- return 1;
- }
- //=====================
- public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerInRangeOfPoint(playerid, radi, x, y, z))
- {
- return 1;
- }
- return 0;
- }
- //=====================FINE ù_ù=============================================
Add Comment
Please, Sign In to add comment