Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- The Power Statue v0.2
- Change-log:
- v0.2
- - Easy change of the statue position.
- v0.3
- - Improved scripting.
- - Using foreach for looping though all players.
- Credits:
- - Zeex (zcmd)
- - Y_Less (foreach)
- - Me (for whole filterscript)
- */
- #include <a_samp>
- #include <zcmd>
- #include <foreach>
- #define MONEY_VALUE 1000 // Amount of money you want to give
- #define xpos 2845.6782 // The X cordinates
- #define ypos -2410.4414 // The y cordinates
- #define zpos 19.1922 // The z cordinates
- new
- bool:StatueOwner[MAX_PLAYERS],
- Statue,
- bool:StatueOwned,
- DeleteStatueTime = 15
- ;
- forward DropStatue(playerid);
- forward DeleteStatue( );
- public OnPlayerConnect(playerid)
- {
- StatueOwner[playerid] = false;
- return 1;
- }
- public OnFilterScriptInit()
- {
- Statue = CreatePickup(1276, 3, xpos,ypos,zpos);
- return 1;
- }
- public DropStatue(playerid)
- {
- if(StatueOwner[playerid] == true)
- {
- StatueOwner[playerid] = false;
- StatueOwned = false;
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid, x, y, z);
- Statue = CreatePickup(1276, 3, x, y, z);
- SetTimerEx("DeleteStatue", DeleteStatueTime*1000, false, "d", Statue);
- }
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(pickupid == Statue)
- {
- new string[128];
- format(string,sizeof(string),"* %s has picked up the Statue.", pName(playerid));
- SendClientMessageToAll(0x52AB5ADD, string);
- StatueOwner[playerid] = true;
- StatueOwned = true;
- DestroyPickup(Statue);
- }
- return 1;
- }
- public DeleteStatue( )
- {
- DestroyPickup(Statue);
- StatueOwned = false;
- Statue = CreatePickup(1276, 3, xpos,ypos,zpos);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(StatueOwner[playerid] == true)
- {
- StatueOwner[playerid] = false;
- StatueOwned = false;
- DeleteStatue( );
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(StatueOwner[playerid] == true) DropStatue(playerid);
- if(StatueOwner[killerid] == true)
- {
- GivePlayerMoney(killerid, MONEY_VALUE);
- new string[50];
- format(string, sizeof(string), "$%i", MONEY_VALUE);
- GameTextForPlayer(killerid, string, 3000, 3);
- }
- return 1;
- }
- COMMAND:statue(playerid, params[])
- {
- if(StatueOwned == true)
- {
- foreach(Player, i)
- {
- if(StatueOwner[i] == true)
- {
- new string[128];
- format(string,sizeof(string),"* The Statue is owned by %s.", pName(playerid));
- SendClientMessage(playerid, 0x52AB5ADD, string);
- }
- }
- }
- else SendClientMessage(playerid,0x52AB5ADD,"The Statue has not owner.");
- return 1;
- }
- stock pName(playerid)
- {
- new
- Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof(Name));
- return Name;
- }
Advertisement
Add Comment
Please, Sign In to add comment