04.01.2013, 20:03
I made this taze command but in game it says , server unkown command in white text
pawn Код:
dcmd_taze(playerid,params[])
{
new string[128];
new ID;
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /taze (Player Name/ID)");
return 1;
}
if(IsSpawned[playerid] != 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
return 1;
}
if(IsKidnapped[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You are kidnapped. You cannot use this command.");
return 1;
}
if(IsFrozen[playerid] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You have been frozen by a Server Administrator. You cannot use this command.");
return 1;
}
if(InAdminMode[ID] == 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command on this player because they are in Administrator mode.");
return 1;
}
if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_CIA)
{
SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can place taze on suspects.");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot taze them",ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) > 4)
{
format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to taze him.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(gTeam[ID] == TEAM_COP || gTeam[ID] == TEAM_ARMY || gTeam[ID] == TEAM_CIA)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot taze another Law Enforcement officer . You might lose your job for that ..");
return 1;
}
if(IsTazed[ID] == 1)
{
format(string,sizeof(string),"%s(%d) is already tazed. You don't want to waste a second taze on them.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot taze a suspect in while in a vehicle. Exit the vehicle first.");
return 1;
}
if(GetPlayerState(ID) == PLAYER_STATE_DRIVER || GetPlayerState(ID) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot taze a suspect while they are in a vehicle. Get them to exit the vehicle first.");
return 1;
}
if(playerid == ID)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot taze yourself.");
return 1;
}
if(IsSpawned[ID] != 1)
{
format(string,sizeof(string),"%s(%d) is not spawned. You cannot taze dead people ..",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(IsFrozen[ID] == 1)
{
format(string,sizeof(string),"%s(%d) is frozen by a Server Administrator. You cannot taze them.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(AttemptedToTazeRecently[playerid] >= 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You are too tired from your last taze attempt. Please wait before tazing again.");
return 1;
}
if(HasTazedRecently[playerid] >= 1)
{
SendClientMessage(playerid,COLOR_ERROR,"You are too tired from the last person you tazed. Please wait before tazing again.");
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) <= 4)
{
SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Suspect Tazed_]]");
format(string,sizeof(string),"You have tazed %s(%d)! They can no longer move for awhile.",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
SendClientMessage(ID,COLOR_DEADCONNECT,"[[_Tazed_]]");
format(string,sizeof(string),"Law enforcement officer %s(%d) has tazed you with his shockgun.",PlayerName(playerid),playerid);
SendClientMessage(ID,COLOR_LIGHTBLUE,string);
TogglePlayerControllable(ID,0);
ApplyAnimation(ID,"PED","BIKE_fall_off",4.1,0,1,1,1,1);
SetTimer("Tazeplayer",3000,0);
return 1;
}
return 1;
}