Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////Taze System///////////////////////////////////////
- //////////////////////////Scripted by Fr3ak/////////////////////////////////////
- ///////////////////////Leave me in the Credits//////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- #include <a_samp>
- #define filterscript
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) rreturn 1
- //-------------- EDIT BELOW THIS LINE --------------
- #define COLOR_KILLED 0x880000FF //The color, when a player gets killed by tazing
- #define COLOR_ERROR 0xFF0000AA //The color the of the message, when an error occurs
- #define COLOR_MSG 0x00FFFFFF //Color of general messages
- #define STUNNED_TIME 4 //The time in seconds the stun lasts
- #define ANTISPAM 5 //The minimum allowed time between /taze commands
- //-----------------NO NEED TO EDIT BELOW THIS LINE -----------------
- new stunned[MAX_PLAYERS];
- new tazetime[MAX_PLAYERS];
- stock ReturnPlayerName(ID)
- {
- new name[25];
- GetPlayerName(ID, name, 25);
- return name;
- }
- stock Float:GetDistanceBetweenPlayers(p1,p2)
- {
- new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
- if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
- {
- return -1.00;
- }
- GetPlayerPos(p1,x1,y1,z1);
- GetPlayerPos(p2,x3,y3,z3);
- return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
- }
- forward stuntimer(taze);
- forward tazetimer(i);
- dcmd_taze(playerid, params[])
- {
- new taze = strval(params);
- if(!strlen(params))
- {
- SendClientMessage(playerid, COLOR_ERROR, "USAGE: /taze [ID]");
- }
- else
- {
- if(IsPlayerConnected(taze))
- {
- if(GetDistanceBetweenPlayers(playerid, taze) <= 6)
- {
- if(tazetime[playerid] == 0)
- {
- new tehtaze = random(5);
- if(tehtaze == 1 || tehtaze == 2 || tehtaze == 3 || tehtaze == 4)
- {
- new string[256], Float:thlth;
- format(string, sizeof(string), "%s (%i) has tazed you.",ReturnPlayerName(playerid), playerid);
- SendClientMessage(taze, COLOR_MSG, string);
- format(string, sizeof(string), "You have tazed %s (%i).",ReturnPlayerName(taze), taze);
- SendClientMessage(playerid, COLOR_MSG, string);
- GetPlayerHealth(taze, thlth);
- new Float:tehtaze3 = thlth-15-random(30);
- SetPlayerHealth(taze, tehtaze3);
- if(thlth < tehtaze3)
- {
- format(string, sizeof(string), "%s (%i) has been tazed to death", ReturnPlayerName(taze), taze);
- SendClientMessageToAll(COLOR_KILLED, string);
- }
- else
- {
- SendClientMessage(taze, COLOR_MSG, "You are stunned for a while.");
- TogglePlayerControllable(taze, 0);
- stunned[taze] = 1;
- tazetime[playerid] = 1;
- SetTimerEx("tazetimer", ANTISPAM*1000, 0, "i", playerid);
- SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", taze);
- }
- }
- else
- {
- new string[256], Float:phlth;
- format(string, sizeof(string), "%s (%i) has accidentally held the tazer the wrong way and tazed himself",ReturnPlayerName(playerid), playerid);
- SendClientMessage(taze, COLOR_MSG, string);
- SendClientMessage(playerid, COLOR_MSG, "You accidentally held the tazer the wrong way and tazed yourself");
- GetPlayerHealth(playerid, phlth);
- new Float:tehtaze2 = phlth-25-random(30);
- SetPlayerHealth(playerid, tehtaze2);
- if(phlth < tehtaze2)
- {
- format(string, sizeof(string), "%s (%i) has been tazed to death",ReturnPlayerName(playerid), playerid);
- SendClientMessageToAll(COLOR_KILLED, string);
- }
- else
- {
- SendClientMessage(playerid, COLOR_MSG, "You are stunned for a while.");
- TogglePlayerControllable(playerid, 0);
- stunned[playerid] = 1;
- SetTimerEx("stuntimer", STUNNED_TIME*1000, 0, "i", playerid);
- SetTimerEx("tazetimer", ANTISPAM*1000, 0, "i", playerid);
- tazetime[playerid] = 1;
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_MSG, "Please wait before tazing someone again!");
- }
- }
- else
- {
- new string[256];
- format(string, sizeof(string), "%s (%i) is not close enough to taze!", ReturnPlayerName(taze), taze);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_MSG, "That player is not connected!");
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(taze, 4, cmdtext);
- return 0;
- }
- public stuntimer(taze)
- {
- stunned[taze] = 0;
- TogglePlayerControllable(taze, 1);
- SendClientMessage(taze, COLOR_MSG, "You have recovered from the tazer-shock");
- }
- public tazetimer(i)
- {
- tazetime[i] = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement