Possibe? - 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)
+--- Thread: Possibe? (
/showthread.php?tid=482488)
Possibe? -
BarFix - 21.12.2013
That possible to make a "warning" for admins if someone killing someone with spraycan or something?
how that works? like what, how to make something like this?
Re: Possibe? -
Voxel - 21.12.2013
Its possible, do research on "OnPlayerGive/TakeDamage" and "GetPlayerWeapon" and you will need to make a stock to send the message to all the online admins.
Re: Possibe? - Patrick - 21.12.2013
I did not really get what you mean, in my understanding, You want to show an admin a warning if the
killer killed someone using a
spraycan.
pawn Код:
//This callback gets called when the player dies.
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid == INVALID_PLAYER_ID ) return false; //if the player is not connected or INVALID, this function will return nothing.
if( GetPlayerWeapon(killerid) == 41)
{
return SendClientMessage(playerid, -1, "You have been killed by a spraycan"), SendClientMessage(killerid, -1, "You killed someone using a spraycan");
}
return true;
}
//This callback gets called when the player gets hit by a specific weapon.
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if( weaponid == 41)//This function gets the player weapon id.
{
return SendClientMessage(playerid, -1, "You have been attacked by a spraycan"), SendClientMessage(issuerid, -1, "You attacked someone using a spraycan");
}
return true;
}
Re: Possibe? -
BarFix - 21.12.2013
Quote:
Originally Posted by Voxel
Its possible, do research on "OnPlayerGive/TakeDamage" and "GetPlayerWeapon" and you will need to make a stock to send the message to all the online admins.
|
Quote:
Originally Posted by pds2k12
I did not really get what you mean, in my understanding, You want to show an admin a warning if the killer killed someone using a spraycan.
pawn Код:
//This callback gets called when the player dies. public OnPlayerDeath(playerid, killerid, reason) { if(killerid == INVALID_PLAYER_ID ) return false; //if the player is not connected or INVALID, this function will return nothing.
if( GetPlayerWeapon(killerid) == 41) { return SendClientMessage(playerid, -1, "You have been killed by a spraycan"), SendClientMessage(killerid, -1, "You killed someone using a spraycan"); } return true; }
//This callback gets called when the player gets hit by a specific weapon. public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid) { if( weaponid == 41)//This function gets the player weapon id. { return SendClientMessage(playerid, -1, "You have been attacked by a spraycan"), SendClientMessage(issuerid, -1, "You attacked someone using a spraycan"); } return true; }
|
Thank you so much, but if you can help me please with that, i'm getting a warning about this:
Quote:
error 021: symbol already defined: "OnPlayerDeath"
|
how to fix that? i used your code!
Re: Possibe? - Patrick - 21.12.2013
Quote:
Originally Posted by BarFix
Thank you so much, but if you can help me please with that, i'm getting a warning about this:
how to fix that? i used your code!
|
Do you have
#include <a_samp on top?
Re: Possibe? -
BarFix - 21.12.2013
Quote:
Originally Posted by pds2k12
Do you have #include <a_samp on top?
|
Yes.
EDIT:
also when i'm using:
Quote:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
if( weaponid == 41)//This function gets the player weapon id.
{
return SendClientMessage(playerid, -1, "You have been attacked by a spraycan"), SendClientMessage(issuerid, -1, "You attacked someone using a spraycan");
}
return true;
}
|
as
Quote:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
new String[ 128 ]
if( weaponid == 41)
{
format(String, sizeof(String), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may possibly Rush Tazed (%s).", GetPlayerNameEx(issuerid), playerid);
ABroadCast(COLOR_YELLOW, String, 2);
}
return true;
}
|
i don't know why that gives me a warning " error 001: expected token: ";", but found "if" "
Re: Possibe? -
Babul - 21.12.2013
you forgot a semicolon ; after
Re: Possibe? -
SilentSoul - 21.12.2013
Already defined
OnPlayerDeath means you have used that callback twice , delete one of them try Control+f and find '
OnPlayerDeath' delete one that useless without codes , i believe that you've copied the codes that he gaved you and paste on your script.