Command -
lsreskjn - 14.02.2014
Hey, I have a command for /kill that show a message that the player committed a suaside ...I olso have OnPlayerDeath that if someone kill someone.. it will show in chat...but when you type /kill it shows the message that player xx killed xxx...is it possible to do it so if player type /kill it will not show that message?
CODES
Код:
if(strcmp("/kill", cmdtext) == 0)
{
SetPlayerHealth(playerid,-1); // zabije hraca
SendClientMessage(playerid, 0x800080FF, "[ Server ] Spбchal si samovraћdu.");
new string[130],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(string,sizeof string,"{C0C0C0}[ Samovraћda ] Hrбc {FF0000}%s{C0C0C0} spбchal samovraћdu.",name);
SendClientMessageToAll(0xFFFFFFAA,string);
printf("Player %s used command %s",Jmeno(playerid), cmdtext);
pDeaths[playerid]-=1;
return 1;
}
Код:
new playername[24], killername[24];
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerName(killerid, killername, sizeof(killername));
PlayAudioStreamForPlayer(playerid, "http://k007.kiwi6.com/hotlink/ha4beyib1d/laugh_dp.wav");
PlayAudioStreamForPlayer(killerid, "http://k007.kiwi6.com/hotlink/sx65ro...amestartup.mp3");
new string[128];
format(string,sizeof string,"{C0C0C0}[ KILL-LIST ] Hrбc %s zabil %s.",killername, playername);
SendClientMessageToAll(0xFFFFFFAA,string);
Re: Command -
CuervO - 14.02.2014
pDeaths[playerid]-=1;
Shouldn't that be ++ or += 1; ?
Set a variable at where the player suicides to 1, then at OnPlayerDeath check if that variable is 1, if so, set the killerid to INVALID_PLAYER_ID and do not send the message.
Re: Command -
lsreskjn - 14.02.2014
Im not sure, im new to pawno and i ony know the basic stuff so i cant script it
Re: Command -
CuervO - 14.02.2014
What I said to do is pretty basic, though.
You only need to know very very basic operatives, anyways...
pawn Код:
if(strcmp("/kill", cmdtext) == 0)
{
SetPlayerHealth(playerid,-1); // zabije hraca
SendClientMessage(playerid, 0x800080FF, "[ Server ] Spбchal si samovraždu.");
new string[130],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(string,sizeof string,"{C0C0C0}[ Samovražda ] Hrбc {FF0000}%s{C0C0C0} spбchal samovraždu.",name);
SendClientMessageToAll(0xFFFFFFAA,string);
printf("Player %s used command %s",Jmeno(playerid), cmdtext);
pDeaths[playerid] ++;
SetPVarInt(playerid,"Suicided",1); // set the variable
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new playername[24], killername[24];
if(GetPVarInt(playerid,"Suicided") == 0) //check if player suicided
{
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerName(killerid, killername, sizeof(killername));
PlayAudioStreamForPlayer(playerid, "http://k007.kiwi6.com/hotlink/ha4beyib1d/laugh_dp.wav");
PlayAudioStreamForPlayer(killerid, "http://k007.kiwi6.com/hotlink/sx65ro...amestartup.mp3");
new string[128];
format(string,sizeof string,"{C0C0C0}[ KILL-LIST ] Hrбc %s zabil %s.",killername, playername);
SendClientMessageToAll(0xFFFFFFAA,string);
}
SetPVarInt(playerid,"Suicided",0); // reset the variable
return 1;
}
Re: Command -
terrow - 14.02.2014
Yes it possible you need to make a variable at first your GM
pawn Код:
new gPlayerUsedKill[ MAX_PLAYERS ];
I don't know to use STRCMP i will show you in ZCMD ..
CMD:kill( playerid, params[ ] )
{
SetPlayerHealth(playerid,-1); // zabije hraca
SendClientMessage(playerid, 0x800080FF, "[ Server ] Spбchal si samovraždu.");
printf("Player %s used command %s",Jmeno(playerid), cmdtext);
pDeaths[playerid]-=1;
gPlayerUsedKill[ playerid ] = 1; // Here is the variable //
return ( 1 );
}
and on player death
if ( gPlayerUsedKill[ playerid ] == 1 )
{
new string[130],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(string,sizeof string,"{C0C0C0}[ Samovražda ] Hrбc {FF0000}%s{C0C0C0} spбchal samovraždu.",name);
SendClientMessageToAll(0xFFFFFFAA,string);
gPlayerUsedKill[ playerid ] = 0;
}
I hope this will be works!