Question about ZCMD
#1

Hello this Command /me /gotols /gotohos /akill /kick /ban not working
i maked it without any error but When in IG testing on other player Explain /akill
it's Killing me huh why it's happen?
here the Code
Код:
CMD:me(playerid, params[])
{
    new string[128],pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,sizeof(pname));
    if(!strlen(params)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /me <text>");
    format(string,sizeof(string),"*%s %s",pname,params);
    SendClientMessageToAll(COLOR_GREY,string);
    return 1;
}
CMD:kick(playerid, params[])
{
        new PID; //define the playerid we wanna kick
        new reason[64]; //the reason, put into a string
        new str[128]; //a new message string
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
        GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
  		GetPlayerName(PID, Playername, sizeof(Playername));
        if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
        if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
        return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        format(str, sizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
		SendClientMessageToAll(COLOR_RED, str); //send that message to all
  		Kick(PID); //kick the playerid we've defined
        return 1;
}
CMD:ban(playerid, params[])
{
        new PID; //define the playerid we wanna kick
        new reason[64]; //the reason, put into a string
        new str[128]; //a new message string
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
        GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
  		GetPlayerName(PID, Playername, sizeof(Playername));
        if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /ban [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
        if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
        return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        format(str, sizeof(str), "'%s' has been Banned by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
		SendClientMessageToAll(COLOR_RED, str); //send that message to all
  		Kick(PID); //kick the playerid we've defined
        return 1;
}
CMD:akill(playerid, params[])
{
        new PID; //define the playerid we wanna kick
        new reason[64]; //the reason, put into a string
        new str[128]; //a new message string
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
        GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
  		GetPlayerName(PID, Playername, sizeof(Playername));
        if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /akill [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
        if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
        return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        format(str, sizeof(str), "'%s' has been akill by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
		SendClientMessageToAll(COLOR_RED, str); //send that message to all
  		SetPlayerHealth(playerid, 0);
        return 1;
}
CMD:freeze(playerid, params[])
{
        new PID; //define the playerid we wanna kick
        new reason[64]; //the reason, put into a string
        new str[128]; //a new message string
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
        GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
  		GetPlayerName(PID, Playername, sizeof(Playername));
        if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /freeze [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
        if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
        return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        format(str, sizeof(str), "'%s' has been freezed by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
		SendClientMessageToAll(COLOR_RED, str); //send that message to all
  		TogglePlayerControllable(playerid,0);
        return 1;
}
CMD:unfreeze(playerid, params[])
{
        new PID; //define the playerid we wanna kick
        new reason[64]; //the reason, put into a string
        new str[128]; //a new message string
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
        GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
  		GetPlayerName(PID, Playername, sizeof(Playername));
        if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /unfreeze [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
        if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
        return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        format(str, sizeof(str), "'%s' has been unfreezed by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
		SendClientMessageToAll(COLOR_RED, str); //send that message to all
  		TogglePlayerControllable(playerid,1);
        return 1;
}
CMD:gotols(playerid, params[])
{
        new PID; //define the playerid we wanna kick
        new reason[64]; //the reason, put into a string
        new str[128]; //a new message string
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
        GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
  		GetPlayerName(PID, Playername, sizeof(Playername));
        if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gotols [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
        if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
        return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        format(str, sizeof(str), "'%s' has been TELEPORTED to ls by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
		SendClientMessageToAll(COLOR_RED, str); //send that message to all
  		SetPlayerPos(playerid,1529.4846,-1715.3315,13.3828);
        return 1;
}
CMD:gotohos(playerid, params[])
{
        new PID; //define the playerid we wanna kick
        new reason[64]; //the reason, put into a string
        new str[128]; //a new message string
        new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
        GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
  		GetPlayerName(PID, Playername, sizeof(Playername));
        if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /gotohos [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
        if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
        return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        format(str, sizeof(str), "'%s' has been TELEPORTED to hos by administrator '%s'. Reason: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
		SendClientMessageToAll(COLOR_RED, str); //send that message to all
  		SetPlayerPos(playerid,1178.0469,-1324.3839,14.1008);
        return 1;
}
NOTE
Not my Scripts Coped it
Reply
#2

The reason is because for you added playerid
pawn Код:
SetPlayerHealth(playerid,0);
In this it has playerid,0 so that means the player who types the command will get killed. But if you do this
pawn Код:
SetPlayerHealth(PID,0);
that will kill the ID

So if you do
/akill 5 Bye bye loser
That will kill id 5 if you add PID
Reply
#3

Oh thanks Rep for you i'll try this man thanks u
Reply
#4

Working Fine Thanks u
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)