Pepper spray -
Lajko1 - 08.11.2013
Hey I want to improve pepper spray and for now I did this:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 41 && IsPlayerCop(playerid))
{
SetPlayerDrunkLevel(playerid, 50000);
ApplyAnimation(playerid,"CRACK","crckdeth1 ",4.0,0,0,0,0,0,0);
}
return 1;
}
So if player is cop and weapon id is 41 (spray) and if I will spray someone his DrunkLevel will be high
And also I want to apply animation but nvm this right now I will choose right animation latter..
Umm will this work? how should I lower SetPlayerDrunkLevel faster? Should I add timer ? or..? and can someone test this for me it will work?
Respuesta: Pepper spray -
Parka - 08.11.2013
remember to recharge the animation or nothing will happen.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid){
if(issuerid != INVALID_PLAYER_ID && weaponid == 41 && IsPlayerCop(playerid)){
SetPlayerDrunkLevel(playerid, 50000);
ApplyAnimation(playerid,"CRACK","null",4.0,0,0,0,0,0,0);
ApplyAnimation(playerid,"CRACK","crckdeth1",4.0,0,0,0,0,0,0);
}
return 1;
}
public OnGameModeInit(){
SetTimer("RemoveEffect",1000,true);
return 1;
}
forward RemoveEffect();
public RemoveEffect(){
for(new i, t=GetMaxPlayers(); i<t; i++){
if(GetPlayerDrunkLevel(i) > 0){
SetPlayerDrunkLevel(i,GetPlayerDrunkLevel(i)-100);
return 1;
}
if(GetPlayerDrunkLevel(i) < 0){
SetPlayerDrunkLevel(i,0);
return 1;
}
}
return 1;
}
Re: Pepper spray -
Lajko1 - 08.11.2013
Well thank you, do you maybe know how should I make that player's screen will be bit fucked up so he won't be able to see, or anything like this?
Respuesta: Pepper spray -
Parka - 08.11.2013
It do a Textdraw that cover all the screen and case resolved
Re: Pepper spray -
Lajko1 - 08.11.2013
Well that's true I was thinking about this too, but I had to ask if there is any other opinion, well I will cover the screen, but I will let chat to be visible, cuz of RolePlay.. umm thank you

REP+
Re: Pepper spray -
Lajko1 - 08.11.2013
Okay I made nice textdraw :P but the problem is how can I make this "effect" only for 15 seconds and textdraws will gone?
This is what I've made but I don't know how to detect if player is sprayed it will trigger timer that will hide those
textdraws, how can I make it?
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 41 && IsPlayerCop(playerid))
{
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
TextDrawShowForPlayer(playerid,Textdraw3);
TextDrawShowForPlayer(playerid,Textdraw4);
ApplyAnimation(playerid,"CRACK","null",4.0,0,0,0,0,0,0);
ApplyAnimation(playerid,"CRACK","crckdeth1",4.0,0,0,0,0,0,0);
}
return 1;
}
Re: Pepper spray -
Beckett - 08.11.2013
Timer?
Re: Pepper spray -
Lajko1 - 08.11.2013
Umm but it will trigger him if player will be sprayed?
Re: Pepper spray -
Lajko1 - 08.11.2013
One more question why textdraws hide for player when animation is applied ? help please, rep+
Re: Pepper spray -
Lajko1 - 08.11.2013
Please?
I tested this with command:
pawn Код:
if (strcmp("/test", cmdtext, true, 5) == 0)
{
ApplyAnimation(playerid,"CRACK","null",4.0,0,0,0,0,0,0);
ApplyAnimation(playerid,"CRACK","crckdeth1",4.0,0,0,0,0,0,0);
IsSprayed[playerid] = 1;
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
TextDrawShowForPlayer(playerid,Textdraw3);
TextDrawShowForPlayer(playerid,Textdraw4);
return 1;
}
but when annimation is applied textdraws sometimes show and than fastly hide :/ how should I fix this?
Will this work?
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 41 && IsPlayerCop(playerid))
{
ApplyAnimation(playerid,"CRACK","null",4.0,0,0,0,0,0,0);
ApplyAnimation(playerid,"CRACK","crckdeth1",4.0,0,0,0,0,0,0);
TextDrawShowForPlayer(playerid,Textdraw0);
TextDrawShowForPlayer(playerid,Textdraw1);
TextDrawShowForPlayer(playerid,Textdraw2);
TextDrawShowForPlayer(playerid,Textdraw3);
TextDrawShowForPlayer(playerid,Textdraw4);
}
return 1;
}
It's really important for me guys.