#1

/kill cmd doesnt working :/

Quote:

COMMAND:kill(playerid, params[])
{
if(PlayerInfo[playerid][gAdmin] > 0)
{
new id; new priez[128];
if (sscanf(params, "dz", id, priez)) return SendClientMessage(playerid, ZALIA, "GangWars: /kill [Vardas] [Prieюastis]");
if (IsPlayerConnected(id))
{
new string[128]; new zaid[128], varduk[128];
GetPlayerName(id,zaid,sizeof(zaid));
GetPlayerName(playerid,varduk,sizeof(varduk));
format(string,sizeof(string),"GangWars: %s nuюudл %s. Prieюastis: %s",varduk,zaid,priez);
SendClientMessageToAll(ZALIA, string);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
PlayerPlaySound(id,1057,0.0,0.0,0.0);
SetPlayerHealth(id,0.0);
}
else
{
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"GangWars", "Юaidлjas nerastas", "Gerai", "Uюdaryti");
}
}
else
{
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX,"GangWars", "Рi komanda TIK Administratoriams!", "Gerai", "Uюdaryti");
}
return 1;
}

im type /kill AndriusZ S and it means:

/kill [Vardas] [Prieћastis]
Reply
#2

pawn Код:
command(kill, playerid, params[])
{
     new PID;
    if(PlayerInfo[playerid][gAdmin] < 5) return SendClientMessage(playerid, COLOR, "Unknown cmd.";
    if(sscanf(params, "u", PID)) return SendClientMessage(playerid, COLOR, "/kill  [ playerid / Name ]");
    return SetPlayerHealth(PID, 0);
}
Should do the trick ( Zcmd & SScanf )
Reply
#3

pawn Код:
COMMAND:kill(playerid, params[])
{
    new
        id,
        string[128],
        zaid[MAX_PLAYER_NAME],
        varduk[MAX_PLAYER_NAME];
    if (PlayerInfo[playerid][gAdmin] <= 0) return ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX, "GangWars", "Рi komanda TIK Administratoriams!", "Gerai", "Uюdaryti");
    if (sscanf(params, "dz", id, string)) return SendClientMessage(playerid, ZALIA, "GangWars: /kill [Vardas] [Prieюastis]");
    if (!IsPlayerConnected(id)) return ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX, "GangWars", "Юaidлjas nerastas", "Gerai", "Uюdaryti");
    GetPlayerName(id, zaid, sizeof(zaid));
    GetPlayerName(playerid, varduk, sizeof(varduk));
    format(string, sizeof(string), "GangWars: %s nuюudл %s. Prieюastis: %s", varduk, zaid, string);
    SendClientMessageToAll(ZALIA, string);
    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
    PlayerPlaySound(id, 1057, 0.0, 0.0, 0.0);
    SetPlayerHealth(id, 0.0);
    return 1;
}
Reply
#4

didnt working;/
Reply
#5

Try this one (Put it inside OnPlayerCommandText):
[Is a simple kill command, you can add more functions to make it as you want to be.]
pawn Код:
new
        index,
        cmd[20];
    cmd = strtok(cmdtext, index);
    if (strcmp(cmd, "/kill", true) == 0)
    {
        new
            tmp[20],
            id;
        tmp = strtok(cmdtext, index);
        if (strlen(tmp))
        {
            id = strval(tmp);
            if (IsPlayerConnected(id))
            {
                SetPlayerHealth(id, 0);
                SendClientMessage(playerid, 0x00FF00AA, "Player killed");
            }
            else
            {
                SendClientMessage(playerid, 0xFF0000AA, "Player not found");
            }
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/kill <playerid>\"");
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)