SA-MP Forums Archive
If command is enabled, effects will be done if a player punches - 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: If command is enabled, effects will be done if a player punches (/showthread.php?tid=397983)



If command is enabled, effects will be done if a player punches - davelord - 07.12.2012

Hi there.

I'm basically looking for a example that'll show me how to do something similar to this.

If a player types a command, for example, /enablesparks, and then clicks (punches), a red or white glow (preferably selectable) will erupt from the player's fist and will go on into the direction of the punch.

http://forum.sa-mp.com/showthread.ph...light=firework (3:20 on the video, the red and white glows)

Is this possible, and could someone give me a example?


Re: If command is enabled, effects will be done if a player punches - DaRk_RaiN - 07.12.2012

Lets start, use a variable for the command
pawn Код:
new Fire[MAX_PLAYERS];//using the variable to delet the player who used the command
Now the command
[PAWN]
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/enablesparks", cmdtext, true, 10) == 0)
{
Fire[playerid]=1;//now the punch will glow.
return 1;
}
return 0;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_FIRE && Fire[playerid] ==1)
{
//now you can make the glow here using what ever you want.
}
return 1;
}


Re: If command is enabled, effects will be done if a player punches - davelord - 07.12.2012

Thanks!