Callback help & other things
#1

Hey guys I have a few questions...

In my script I have this callback, but when I /kill it doesn't work. What I'm trying to say is, when I do /kill, I want a message sent to the whole chat saying.

(name) has commited suicide using /kill

here it is.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/kill", cmdtext, true, 10) == 0)
    {
        ClearAnimations(playerid,5);
        SetPlayerHealth(playerid,0);
        SendClientMessage(playerid,0xEAFF00FF,"You have commited sucide");
        SetPlayerScore(playerid, GetPlayerScore(playerid) - 2);
        new msg[128],
        suicider[MAX_PLAYER_NAME];
        GetPlayerName(playerid, suicider, sizeof suicider);
        format(msg, sizeof(msg), "%s has commited suicide using kill!", suicider);
        SendClientMessageToAll(0xFF0000FF, msg);
        return 1;
    }
And......

Is there a command that allows a admin to kill someone as a punishment?
If you know the code, could you please post it.

Thanks
Reply
#2

What do you mean by "the callback doesn't work"?
Yeah there exists such command to kill a player, you will have to code it.
Reply
#3

Hello can anyone answer?
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/kill", cmdtext, true, 10) == 0)
    {
        ClearAnimations(playerid);
        SetPlayerHealth(playerid,0);
        SendClientMessage(playerid,0xEAFF00FF,"You have commited sucide");
        SetPlayerScore(playerid, GetPlayerScore(playerid) - 2);
        new msg[128],
        suicider[MAX_PLAYER_NAME];
        GetPlayerName(playerid, suicider, sizeof suicider);
        format(msg, sizeof(msg), "%s has commited suicide using kill!", suicider);
        SendClientMessageToAll(0xFF0000FF, msg);
        return 1;
    }
    return 0;
}
Reply
#5

The lenght of "/kill" is not 10, but 5. Also, it should return false at the end of the callback.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/kill", cmdtext, true, 5) == 0)
    {
        ClearAnimations(playerid,5);
        SetPlayerHealth(playerid,0);
        SendClientMessage(playerid,0xEAFF00FF,"You have commited sucide");
        SetPlayerScore(playerid, GetPlayerScore(playerid) - 2);
        new msg[128],
        suicider[MAX_PLAYER_NAME];
        GetPlayerName(playerid, suicider, sizeof suicider);
        format(msg, sizeof(msg), "%s has commited suicide using kill!", suicider);
        SendClientMessageToAll(0xFF0000FF, msg);
        return 1;
    }  
    return 0;
}
Reply
#6

I get this error message:

Код:
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1096) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1105) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1149) : error 029: invalid expression, assumed zero
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1149) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1159) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1177) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1179) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1190) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1192) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1194) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1196) : error 021: symbol already defined: "GetPlayerName"
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1199) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1201) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1203) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1206) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1208) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1214) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1216) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1222) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1224) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1226) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1229) : error 021: symbol already defined: "GetPlayerName"
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1233) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1235) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1239) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1241) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1244) : error 010: invalid function or declaration
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1246) : error 010: invalid function or declaration

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#7

You forgot to close the bracket(s)
pawn Код:
That symbol => }
Reply
#8

Also, do you know the code so a admin can kill someone as a punishment.
Reply
#9

Replying to: Dwane

Dwane, the code you posted still doesn't work. When I do /kill, no message comes up.
Reply
#10

Atleast, does it make you suicide or it doesn't work at all, because the command is just fine.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)