Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <foreach>
- #define Coords Float:pX, Float:pY, Float:pZ
- #define coords pX, pY, pZ
- enum pamestu_pinigu_items
- {
- pamesti_Pinigai,
- pamesti_Pickup
- }
- new Pamesta[MAX_PLAYERS][pamestu_pinigu_items];
- stock destroyLostMoneyPickup(playerid)
- {
- if(Pamesta[playerid][pamesti_Pinigai] == -1 && Pamesta[playerid][pamesti_Pickup] == -1) return 0;
- Pamesta[playerid][pamesti_Pinigai] = -1;
- DestroyPickup(Pamesta[playerid][pamesti_Pickup]);
- Pamesta[playerid][pamesti_Pickup] = -1;
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- Pamesta[playerid][pamesti_Pinigai] = -1;
- Pamesta[playerid][pamesti_Pickup] = -1;
- return 1;
- }
- public OnFilterScriptInit()
- {
- for(new i; i < MAX_PLAYERS; i++)
- {
- Pamesta[i][pamesti_Pickup] = -1;
- Pamesta[i][pamesti_Pinigai] = -1;
- }
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- foreach(Player, i)
- {
- if(pickupid == Pamesta[i][pamesti_Pickup])
- {
- GivePlayerMoney(playerid, Pamesta[i][pamesti_Pinigai]);
- DestroyPickup(Pamesta[i][pamesti_Pickup]);
- Pamesta[i][pamesti_Pickup] = -1;
- Pamesta[i][pamesti_Pinigai] = -1;
- return 1;
- }
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- destroyLostMoneyPickup(playerid);
- if(GetPlayerMoney(playerid) > 0)
- {
- new Coords;
- GetPlayerPos(playerid, Coords);
- Pamesta[playerid][pamesti_Pinigai] = GetPlayerMoney(playerid);
- Pamesta[playerid][pamesti_Pickup] = CreatePickup(1550, 23, coords, 0);
- ResetPlayerMoney(playerid);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment