Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Tretminen-FS
- (c) 2012 by pwnfl4sh
- */
- #include <a_samp>
- #include <zcmd>
- #define PREIS 0 // preis pro tretmine
- forward BombTimer();
- enum b_Info
- {
- b_Object,
- Float:b_Pos[3],
- bool:b_Active
- }
- new BombInfo[MAX_PLAYERS][b_Info];
- public OnFilterScriptInit()
- {
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- ResetPlayerBombStats(i);
- }
- SetTimer("BombTimer",1000,true);
- print("TretMinen-FS gestartet!");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("TretMinen-FS beendet!");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- ResetPlayerBombStats(playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid,reason)
- {
- ResetPlayerBombStats(playerid);
- return 1;
- }
- public BombTimer()
- {
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(IsPlayerConnected(i))
- {
- if(IsPlayerInRangeOfBomb(i) != -1)
- {
- SendClientMessage(i,0xFF0000FF,"Du bist auf eine Tretmine getreten :D");
- new b = IsPlayerInRangeOfBomb(i);
- ExplodeBomb(b);
- }
- }
- }
- return 1;
- }
- ResetPlayerBombStats(playerid)
- {
- if(BombInfo[playerid][b_Active] == true)
- {
- DestroyObject(BombInfo[playerid][b_Object]);
- BombInfo[playerid][b_Active] = false;
- }
- return 1;
- }
- ExplodeBomb(playerid)
- {
- if(BombInfo[playerid][b_Active] == false) return 0;
- CreateExplosion(BombInfo[playerid][b_Pos][0],BombInfo[playerid][b_Pos][1],BombInfo[playerid][b_Pos][2],6,20.0);
- ResetPlayerBombStats(playerid);
- return 1;
- }
- IsPlayerInRangeOfBomb(playerid,Float:range = 2.0)
- {
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(BombInfo[i][b_Active] == true)
- {
- if(IsPlayerInRangeOfPoint(playerid,range,BombInfo[i][b_Pos][0],BombInfo[i][b_Pos][1],BombInfo[i][b_Pos][2]))
- {
- return i;
- }
- }
- }
- return -1;
- }
- CreateBomb(playerid,Float:x,Float:y,Float:z)
- {
- BombInfo[playerid][b_Object] = CreateObject(1654,x,y,z-1.0,0.0,0.0,0.0);
- BombInfo[playerid][b_Pos][0] = x;
- BombInfo[playerid][b_Pos][1] = y;
- BombInfo[playerid][b_Pos][2] = z;
- BombInfo[playerid][b_Active] = true;
- return 1;
- }
- COMMAND:terstellen(playerid,params)
- {
- if(BombInfo[playerid][b_Active] == true) return SendClientMessage(playerid,0xFF0000FF,"Deine Tretmine ist bereits aktiv, bitte warte bis sie ausgelöst wird.");
- if(GetPlayerMoney(playerid) < PREIS)
- {
- new str[144];
- format(str,144,"Du brauchst $%d!",PREIS);
- SendClientMessage(playerid,0xFF0000FF,str);
- return 1;
- }
- GivePlayerMoney(playerid,-PREIS);
- new Float:Pos[3];
- GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
- CreateBomb(playerid,Pos[0],Pos[1]+2.5,Pos[2]);
- return 1;
- }
- COMMAND:tentschaerfen(playerid,params[])
- {
- if(IsPlayerInRangeOfBomb(playerid,4.0) == -1) return SendClientMessage(playerid,0xFF0000FF,"Du bist nicht in der Nähe einer Tretmine!");
- new b = IsPlayerInRangeOfBomb(playerid,4.0);
- ResetPlayerBombStats(b);
- SendClientMessage(playerid,0xFF0000FF,"Tretmine entschärft.");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement