Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ==================================================
- |[FS]Mine by Sig Hansen and Shane Beddow |
- ==================================================
- */
- #include <a_samp>
- #define WHITE 0xFFFFFFFF
- new countpos[MAX_PLAYERS];
- new timer[MAX_PLAYERS];
- new Text3D:laber[MAX_PLAYERS];
- new mine[MAX_PLAYERS][2];
- new status[MAX_PLAYERS];
- new minePickup[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext,"/mine",true)==0)
- {
- if (IsPlayerInAnyVehicle(playerid))
- {
- SendClientMessage(playerid, WHITE, " You're in the car, so you are prohibited from using the command!!");
- return 1;
- }
- if(status[playerid] == 1)
- {
- SendClientMessage(playerid, WHITE, " You have already established a mine!");
- return 1;
- }
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- mine[playerid][0] = CreateObject(2992, X, Y, Z-0.85, 0.0, 0.0, 0.0);
- mine[playerid][1] = CreateObject(19290, X, Y, Z-0.85, 0.0, 0.0, 0.0);
- status[playerid] = 1;
- countpos[playerid] = 11;
- dtext(playerid);
- return 1;
- }
- return 0;
- }
- forward dtext(playerid);
- public dtext(playerid)
- {
- timer[playerid] = SetTimerEx("dtext", 1000, 0, "i", playerid);
- new Float:X, Float:Y, Float:Z;
- GetObjectPos(mine[playerid][0], X, Y, Z);
- if(countpos[playerid] == 11)
- {
- laber[playerid] = Create3DTextLabel("to activate the left: \n10 seconds!",0x00F900AA,X,Y,Z+1,40.0,0);
- countpos[playerid] = 10;
- }
- else if(countpos[playerid] == 10)
- {
- Update3DTextLabelText(laber[playerid], 0x64F801AA, "to activate the left: \n9 seconds!");
- countpos[playerid] = 9;
- }
- else if(countpos[playerid] == 9)
- {
- Update3DTextLabelText(laber[playerid], 0xBAF801AA, "to activate the left: \n8 seconds!");
- countpos[playerid] = 8;
- }
- else if(countpos[playerid] == 8)
- {
- Update3DTextLabelText(laber[playerid], 0xDAF900AA, "to activate the left: \n7 seconds!");
- countpos[playerid] = 7;
- }
- else if(countpos[playerid] == 7)
- {
- Update3DTextLabelText(laber[playerid], 0xFCEB18AA, "to activate the left: \n6 seconds!");
- countpos[playerid] = 6;
- }
- else if(countpos[playerid] == 6)
- {
- Update3DTextLabelText(laber[playerid], 0xFCCE18AA, "to activate the left: \n5 seconds!");
- countpos[playerid] = 5;
- }
- else if(countpos[playerid] == 5)
- {
- Update3DTextLabelText(laber[playerid], 0xFBA71AAA, "to activate the left: \n4 seconds!");
- countpos[playerid] = 4;
- }
- else if(countpos[playerid] == 4)
- {
- Update3DTextLabelText(laber[playerid], 0xFA6F1BAA, "to activate the left: \n3 seconds!");
- countpos[playerid] = 3;
- }
- else if(countpos[playerid] == 3)
- {
- Update3DTextLabelText(laber[playerid], 0xFA421BAA, "to activate the left: \n2 seconds!");
- countpos[playerid] = 2;
- }
- else if(countpos[playerid] == 2)
- {
- Update3DTextLabelText(laber[playerid], 0xFF0F0FAA, "to activate the left: \n1 second!");
- countpos[playerid] = 1;
- }
- else if(countpos[playerid] == 1)
- {
- KillTimer(timer[playerid]);
- Delete3DTextLabel(laber[playerid]);
- countpos[playerid] = 0;
- minePickup[playerid] = CreatePickup(0, 1, X, Y, Z, -1);
- }
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) {continue;}
- if(status[i] == 0) {continue;}
- if(pickupid == minePickup[i])
- {
- new Float:X, Float:Y, Float:Z;
- GetObjectPos(mine[i][0], X, Y, Z);
- CreateExplosion(X, Y, Z, 7, 1);
- DestroyPickup(minePickup[i]);
- DestroyObject(mine[i][0]);
- DestroyObject(mine[i][1]);
- status[i] = 0;
- }
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(status[playerid] == 1)
- {
- DestroyPickup(minePickup[playerid]);
- DestroyObject(mine[playerid][0]);
- DestroyObject(mine[playerid][1]);
- status[playerid] = 0;
- KillTimer(timer[playerid]);
- Delete3DTextLabel(laber[playerid]);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement