SA-MP Forums Archive
Whats wrong here? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats wrong here? (/showthread.php?tid=259813)



Whats wrong here? - Alex_Obando - 06.06.2011

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;
}



Re: Whats wrong here? - Backwardsman97 - 06.06.2011

No brackets?


Respuesta: Whats wrong here? - Alex_Obando - 06.06.2011

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


Re: Whats wrong here? - Calgon - 06.06.2011

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];



Re: Whats wrong here? - grand.Theft.Otto - 06.06.2011

delete


Respuesta: Whats wrong here? - Alex_Obando - 06.06.2011

How can I make this:

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


Re: Whats wrong here? - grand.Theft.Otto - 06.06.2011

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.


Re: Whats wrong here? - Tee - 06.06.2011

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.