Whats wrong here?
#1

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{


    if(GetPlayerWeapon(killerid) == 38)
    new name[MAX_PLAYER_NAME];
    new str[128];
    GetPlayerName(killerid, name, sizeof(name));
    format(str, sizeof(str),"%s is suspected of having a weapon hack (Minigun).", name);
    SendClientMessageToAdmins(0xFFFFFFAA, string);
    return 1;
}
Reply
#2

No brackets?
Reply
#3

What you mean?
Can I have an example to get my solution?
Reply
#4

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(GetPlayerWeapon(killerid) == 38) {
    new name[MAX_PLAYER_NAME];
    new str[128];
    GetPlayerName(killerid, name, sizeof(name));
    format(str, sizeof(str),"%s is suspected of having a weapon hack (Minigun).", name);
    SendClientMessageToAdmins(0xFFFFFFAA, string);
    }
    return 1;
}
You need to properly use brackets after if statements. The only thing your code did was create 'name' if killerid had weapon 38, because if you don't include brackets for a statement, it processes the lines up to the nearest semi-colon ( ; ), so it'd have only done:

pawn Код:
new name[MAX_PLAYER_NAME];
Reply
#5

delete
Reply
#6

How can I make this:

If the player is in some specific place like minigun minigame then dont send the message.?
Reply
#7

You have to make a variable.

Just pretend this is your minigun game:
pawn Код:
// top of script
new inmg[MAX_PLAYERS]; // mg = minigun (in minigun)

// command

if(strcmp(cmdtext, "/mg", true, 3) == 0)
{
    // give the minigun, send messages, other codes here, blabla
        inmg[playerid] = 1;
        return 1;
}  

// onplayerdeath

    if(GetPlayerWeapon(killerid) == 38 && inmg[playerid] != 1) //
    {
    new name[MAX_PLAYER_NAME];
    new str[128];
    GetPlayerName(killerid, name, sizeof(name));
    format(str, sizeof(str),"%s is suspected of having a weapon hack (Minigun).", name);
    SendClientMessageToAdmins(0xFFFFFFAA, string);
    }
    return 1;
}

// ! means NOT as a short form
// != NOT equal to
// so therefore: if they are NOT in mg, it will show, but if they are, it wont show
Hope you understood, let me know if you need help.
Reply
#8

In his case, the brackets were the problem. But if he wants when a player types /mg they get a minigun but don't get banned, then he can use your way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)