15.07.2011, 10:18
I looked for Pistol Taser, but i didn't find it, do you know, where it is or could you post me this FS?
OnPlayerCommandText:
if(strcmp(cmd, "/tazer", true) ==0)
{
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid))
{
new x_job[20];
x_job = strtok(cmdtext, idx);
if(!strlen(x_job))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /tazer [get/putup]");
return 1;
}
tmp = strtok(cmdtext, idx);
if(strcmp(x_job,"get",true) == 0)
{
PlayerHasTazer[playerid] = 1;
SetPlayerAttachedObject(playerid, 0, 18642, 6, 0.06, 0.01, 0.08, 180.0, 0.0, 0.0);
format(string, sizeof(string), "* %s unholsters his tazer.", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else if(strcmp(x_job,"putup",true) == 0)
{
PlayerHasTazer[playerid] = 0;
RemovePlayerAttachedObject(playerid, 0);
format(string, sizeof(string), "* %s holsters his tazer back.", PlayerName(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Cop / FBI / RCSD.");
}
}
return 1;
}
new PlayerHasTazer[MAX_PLAYERS]; Put it somewhere with the other new functions.
PlayerHasTazer[playerid] = 0; = OnPlayerConnect.
OnPlayerKeyStateChange:
if ((newkeys & KEY_FIRE))
{
if(PlayerHasTazer[playerid] == 1)
{
ApplyAnimation(playerid,"KNIFE","knife_3",4.1,0,1,1,0,0,1);
new victimid = GetClosestPlayer(playerid);
if(IsPlayerConnected(victimid))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(GetDistanceBetweenPlayers(playerid,victimid) < 2)
{
new Float:health;
GetPlayerHealth(victimid, health);
SetPlayerHealth(victimid, health - 5.0);
new string[128];
TogglePlayerControllable(i, 0);
format(string, sizeof(string), "* You were tazed by %s for 8 seconds.", PlayerName(playerid));
SendClientMessage(i, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You tazed %s for 8 seconds.", PlayerName(i));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s shoots with his tazer at %s, and tazed him.", PlayerName(playerid) ,PlayerName(i));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerTazed[i] = 1;
SetTimerEx("Tazed",8000, false, "i", i);
ApplyAnimation(i, "PED","FLOOR_hit_f", 4.0, 1, 0, 0, 0, 0);
return 1;
}
}
}
}
}
pawn Code:
|