Will this work?
#1

Im on a computer without pawno or gtasa atm so i cannot test it,

pawn Код:
dcmd_tazer(playerid, params[])
{
  if(gTeam[playerid] != TEAM_POLICELS) {
    SendClientMessage(playerid,COLOR_RED,"[ERROR] You need to be a police officer to use this command");
  }
  else if(sscanf(params,"u",id)) {
    SendClientMessage(playerid,COLOR_RED,"[USAGE] /tazer [ID]");
  }
  else if(!IsPlayerConnected(id)) {
    SendClientMessage(playerid,COLOR_RED,"Player is not connected");
  }
  else if(gTeam[id] == TEAM_POLICESF) {
    SendClientMessage(playerid,COLOR_RED,"[ERROR] You cannot tazer a colleague");
  }
  else if(id == playerid) {
    SendClientMessage(playerid,COLOR_RED,"[ERROR] You cannot tazeryourself");
  }
  else {
    new name[MAX_PLAYER_NAME], string[48];
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(id, name1, sizeof(name1));
    format(string, sizeof(string), "Police Officer %s has tazerd %s.", name, name1);
    SendClientMessageToAll(COLOR_WHITE, string);
    SetTimerEx("Tazer", 5000, 0, "i", playerid);
    TogglePlayerControllable(playerid, 0);
    ApplyAnimation(playerid,"CRACK","crckdeth1",4.1,1,1,1,1,1);
  }
  return 1;
}

public Tazer(playerid)
{
TogglePlayerControllable(playerid,1);
ClearAnimations(playerid);
}
If somethings wrong could you correct it,
Also i cant see what animations what,
So if the animation im using is different to what they use on roleplay,
Please change it
Reply
#2

switch out the order of the message "you cannot tazer a colleague" and "you cannot tazor yourself" otherwise you won't ever see the second message.
you didn't create 'name1'
You're sending 'playerid' through the timer, you need to send 'id'
Reply
#3

hi,

the IsPlayerConnected test is done by sscanf (not sure with the old versions but the plugin does it) so you can replace !IsPlayerConnected(playerid) by playerid == INVALID_PLAYER_ID
also, you should check the distance, according to me tazing someone 5 km away from you isn't normal.

++Sim++
Reply
#4

pawn Код:
dcmd_tazer(playerid, params[])
{
    #pragma unused params
  new giveplayer[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    new string[256];
    if(IsPlayerConnected(playerid))
      {
        if(GetPlayerTeam(playerid) == 1)
        {
        if(IsPlayerInAnyVehicle(playerid))
        {
        SendClientMessage(playerid, COLOR_RED, "You cannot use this command while your in a car.");
        return 1;
        }
        new suspect = GetClosestPlayer(playerid);
        if(IsPlayerConnected(suspect))
        {
        if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
        {
        if(gTeam[suspect] == 2)
        {
        SendClientMessage(playerid, COLOR_RED, "Cannot Tazer A Fellow Cop");
        return 1;
        }
        if(IsPlayerInAnyVehicle(suspect))
        {
        SendClientMessage(playerid, COLOR_RED, "You cannot tazer someone in a car");
        return 1;
        }
        GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* You were Tazed by %s for 8 seconds.", sendername);
        SendClientMessage(suspect, COLOR_GREEN, string);
        format(string, sizeof(string), "* You Tazed %s for 8 seconds.", giveplayer);
        SendClientMessage(playerid, COLOR_GREEN, string);
        format(string, sizeof(string), "* %s shoots with his Tazer at %s, and tazed him.", sendername ,giveplayer);
        ProxDetector(30.0, playerid, string, COLOR_BLUE,COLOR_BLUE,COLOR_BLUE,COLOR_BLUE,COLOR_BLUE);
        GameTextForPlayer(suspect, "~r~Tazed", 2500, 3);
        TogglePlayerControllable(suspect, 0);
        }
        else
        {
        SendClientMessage(playerid, COLOR_RED, "This player is not near you.");
        return 1;
        }
        }
        }
        else
        {
        SendClientMessage(playerid, COLOR_RED, "You are not a Cop.");
        }
        }//not connected
    return 1;
    }
Took it straight of godfather script,
I got the proxdetector of there too,
Will it work, Is the question xd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)