Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #define MAX_TREASURE 40
- new treasure[MAX_TREASURE];
- new Text3D:Label[MAX_TREASURE];
- new treasures;
- #define COLOR_BLUE 0x009AE5B0
- #define COLOR_YELLOW 0xFFFF00B4
- #define COLOR_RED 0xB40000B5
- public OnFilterScriptInit()
- {
- print("\n======================================");
- print(" TRL Treasure Hunt by Rage Loaded!");
- print("======================================\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n======================================");
- print(" TRL Treasure Hunt by Rage Loaded!");
- print("======================================\n");
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- for(new i=1; i<MAX_TREASURE; i++)
- {
- if(pickupid == treasure[i]){
- new prize= random(5);
- switch(prize){
- case 0:
- { GivePlayerMoney(playerid, 10000);
- SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found $10,000. Enjoy!");
- destroytext(i);
- treasure[i]=0;
- break;
- }
- case 1:
- { GivePlayerMoney(playerid, 10000);
- SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found $10,000. Enjoy!");
- destroytext(i);
- treasure[i]=0;
- break;
- }
- case 2:
- {
- GivePlayerMoney(playerid, 5000);
- SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found $5,000. Enjoy!");
- destroytext(i);
- treasure[i]=0;
- break;
- }
- case 3:
- {
- GivePlayerMoney(playerid, 5000);
- SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found $5,000. Enjoy!");
- destroytext(i);
- treasure[i]=0;
- break;
- }
- case 4:
- {
- GivePlayerWeapon(playerid,36,50);
- SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found a Rocket launcher(50 Ammos). Enjoy!");
- destroytext(i);
- treasure[i]=0;
- break;
- }
- case 5:
- {
- GivePlayerWeapon(playerid, 38,200);
- SendClientMessage(playerid, COLOR_YELLOW, "Treasure Found! Congratulations You have found a Minigun(100 Ammos). Enjoy!");
- destroytext(i);
- treasure[i]=0;
- break;
- }
- }
- destroytext(i);
- break;
- }
- }
- return 1;
- }
- CMD:ctreasure(playerid, params[]){
- if(IsPlayerAdmin(playerid)){
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- for(new i=1;i<MAX_TREASURE;i++){
- if(treasure[i]==0){
- treasure[i]=CreatePickup(1274,19,x-1.5,y-1.5,z+0.5,0);
- new strr[123];
- format(strr, sizeof(strr)," Treasure \nID:%d",i);
- Label[i]=Create3DTextLabel(strr,0xEBFF0077, x-1.5,y-1.5,z+0.8, 5, 0, 0);
- new str[123];
- format(str,sizeof(str),"You successfully created a treasure(ID:%d) Type /destroyt [Treasure ID] to Destroy it",i);
- SendClientMessage(playerid, COLOR_BLUE,str);
- treasures++;
- break;
- }
- }
- }
- else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command");
- return 1;
- }
- CMD:destroyt(playerid,params[]){
- if(IsPlayerAdmin(playerid)){
- new tid;
- if (sscanf(params, "i", tid)) return SendClientMessage(playerid,COLOR_RED,"Usage: /destroyt [Treasure ID]");
- destroytext(tid);
- new str[123];
- format(str,sizeof(str),"Success: Your Request for Deleting Treasure(ID:%d) has been accepted. Treasure would have been deleted if it was existing..", tid);
- SendClientMessage(playerid, COLOR_RED, str);
- }
- else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command");
- return 1;
- }
- CMD:destroyallt(playerid, params[]){
- if(IsPlayerAdmin(playerid)){
- for(new i=0;i<MAX_TREASURE;i++){
- destroytext(i);
- }
- SendClientMessage(playerid, COLOR_RED, "You have deleted all treasures that were placed");
- }
- else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command");
- return 1;
- }
- stock destroytext(id){
- DestroyPickup(treasure[id]);
- Delete3DTextLabel(Label[id]);
- }
Add Comment
Please, Sign In to add comment