Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //==============================================================================================
- // ALLGEMEINE EINSTELLUNGEN
- new kannsterben = 1; // Ob man bei einem Tazerangriff sterben kann ( 1 = Ein | 0 = Aus)
- #define tazer 30000 // Die Zeit, wielange man den Tazer nicht nutzen kann in Milisekunden
- #define ablauf 15000 // Die Zeit, wielange man getazert ist in Milisekunden
- //==============================================================================================
- #include <a_samp>
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_PURPLE 0x9E18E7FF
- forward IsACop(playerid);
- forward tablauf(playerid);
- forward untazer(playerid);
- //------------------------------------
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Tazer-System | (C) by Firerfan ");
- print("--------------------------------------\n");
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_FIRE)
- {
- if(GetPlayerWeapon(playerid)==13)
- {
- if(IsACop(playerid))
- {
- if(GetPVarInt(playerid,"tused") == 0)
- {
- new Float:cx,Float:cy,Float:cz;
- GetPlayerPos(playerid,cx,cy,cz);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(playerid != i)
- {
- if(!IsACop(i))
- {
- if(IsPlayerInRangeOfPoint(i,2.0,cx,cy,cz))
- {
- if(GetPVarInt(i,"tazered") == 0)
- {
- new trand = random(20);
- if(trand==10 && kannsterben==1)
- {
- new name[MAX_PLAYER_NAME],cname[MAX_PLAYER_NAME],string[286];
- GetPlayerName(i,name,sizeof(name));
- GetPlayerName(playerid,cname,sizeof(cname));
- format(string, sizeof(string), "%s hat %s bei einem Tazerversuch getötet",cname,name);
- printf(string);
- format(string, sizeof(string), "** %s Tazert %s **",cname,name);
- ProxDetector(15.0,i,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SetPlayerHealth(i,0);
- SetPVarInt(playerid,"tused",1);
- SetTimerEx("tablauf",tazer,0,"i",playerid);
- format(string, sizeof(string), "** Du hast %s bei einem Tazerversuch getötet!",name);
- SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
- format(string, sizeof(string), "** %s hat dich bei einem Tazerversuch getötet!",cname);
- SendClientMessage(i,COLOR_LIGHTBLUE,string);
- }
- else
- {
- new name[MAX_PLAYER_NAME],cname[MAX_PLAYER_NAME],string[286];
- GetPlayerName(i,name,sizeof(name));
- GetPlayerName(playerid,cname,sizeof(cname));
- format(string, sizeof(string), "%s hat erfolgreich %s getazert",cname,name);
- printf(string);
- format(string, sizeof(string), "** %s Tazert %s **",cname,name);
- ProxDetector(15.0,i,string,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- SetPVarInt(i,"tazered",1);
- SetPVarInt(i,"tused",1);
- TogglePlayerControllable(playerid,0);
- SetTimerEx("untazer",ablauf,0,"i",i);
- SetTimerEx("tablauf",tazer,0,"i",playerid);
- GameTextForPlayer(i,"~b~Getazert!",5000,3);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- public IsACop(playerid)
- {
- switch (GetPlayerSkin(playerid))
- {
- case 280,281,282,283,284,285:
- {
- return 1;
- }
- }
- return 0;
- }
- public untazer(playerid)
- {
- TogglePlayerControllable(playerid,1);
- SetPVarInt(playerid,"tazered",0);
- SendClientMessage(playerid,COLOR_LIGHTBLUE,"** Du kannst dich langsam wieder bewegen...");
- }
- public tablauf(playerid)
- {
- SetPVarInt(playerid,"tused",0);
- SendClientMessage(playerid,COLOR_LIGHTBLUE,"** Du kannst deinen Tazer nun wieder benutzen!");
- }
- forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
- public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- SendClientMessage(i, col5, string);
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement