[HELP] Command Help
#1

Hello!

I made a command like this:

pawn Код:
if(strcmp(cmd, "/a***f**k", true) == 0)
    {
    if(IsPlayerAdmin(playerid))
    if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /analfuck [id]");
    if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFFFFFFFF, "Player not connected.");
    new str[128],fpname[MAX_PLAYER_NAME],myname[MAX_PLAYER_NAME];
    GetPlayerName(strval(tmp),fpname,sizeof(fpname));
    GetPlayerName(playerid,myname,sizeof(myname));
    format(str,128,"%s has taken %s's *********. He ***** them into their ****! The impact was so hard that the user died!",myname,fpname);
    SetPlayerHealth(playerid, 0);
    SendClientMessageToAll(0xFF66FFAA,str);
    return 1;
    }
But the problem is. When I am not rcon and a player use this command, then he dies and it says "HisName has taken HisName's *********. He ***** them into their ****! The impact was so hard that the user died!"

But when I'm logged in as RCON then all works. Like "MyName has taken PlayersName's *********. He ***** them into their ****! The impact was so hard that the user died!"

I want, that only the RCON can use this command. How to fix this?

Thank You and +REP to give.
Reply
#2

pawn Код:
if(strcmp(cmd, "/a***f**k", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /analfuck [id]");
        if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFFFFFFFF, "Player not connected.");
        new str[128],fpname[MAX_PLAYER_NAME],myname[MAX_PLAYER_NAME];
        GetPlayerName(strval(tmp),fpname,sizeof(fpname));
        GetPlayerName(playerid,myname,sizeof(myname));
        format(str,128,"%s has taken %s's *********. He ***** them into their ****! The impact was so hard that the user died!",myname,fpname);
        SetPlayerHealth(playerid, 0);
        SendClientMessageToAll(0xFF66FFAA,str);
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Stevo127
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/a***f**k", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /analfuck [id]");
        if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFFFFFFFF, "Player not connected.");
        new str[128],fpname[MAX_PLAYER_NAME],myname[MAX_PLAYER_NAME];
        GetPlayerName(strval(tmp),fpname,sizeof(fpname));
        GetPlayerName(playerid,myname,sizeof(myname));
        format(str,128,"%s has taken %s's *********. He ***** them into their ****! The impact was so hard that the user died!",myname,fpname);
        SetPlayerHealth(playerid, 0);
        SendClientMessageToAll(0xFF66FFAA,str);
    }
    return 1;
}
Errors. Many Errors :S
Reply
#4

Quote:
Originally Posted by Stevo127
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/a***f**k", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        if(strlen(tmp) == 0) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /analfuck [id]");
        if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFFFFFFFF, "Player not connected.");
        new str[128],fpname[MAX_PLAYER_NAME],myname[MAX_PLAYER_NAME];
        GetPlayerName(strval(tmp),fpname,sizeof(fpname));
        GetPlayerName(playerid,myname,sizeof(myname));
        format(str,128,"%s has taken %s's *********. He ***** them into their ****! The impact was so hard that the user died!",myname,fpname);
        SetPlayerHealth(playerid, 0);
        SendClientMessageToAll(0xFF66FFAA,str);
    }
    return 1;
}
Quote:
Originally Posted by martin3644
Посмотреть сообщение
Errors. Many Errors :S
Oops my bad. All works. Thank you!
Reply
#5

Quote:
Originally Posted by martin3644
Посмотреть сообщение
Errors. Many Errors :S
That would be because your command fails in quite a few ways....
This:

pawn Код:
if(strcmp(cmd, "/a***f**k", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        new ID = strval(tmp);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /analfuck [id]");
        if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFFFFFFFF, "Player not connected.");
        new str[128],fpname[MAX_PLAYER_NAME],myname[MAX_PLAYER_NAME];
        GetPlayerName(ID,fpname,sizeof(fpname));
        GetPlayerName(playerid,myname,sizeof(myname));
        format(str,128,"%s has taken %s's *********. He ***** them into their ****! The impact was so hard that the user died!",myname,fpname);
        SetPlayerHealth(ID, 0);
        SendClientMessageToAll(0xFF66FFAA,str);
    }
    return 1;
}
EDIT: Or it works, but either way, the command above is more efficient.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)