Noob... - 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: Noob... (
/showthread.php?tid=362215)
Noob... -
DizzY2306 - 23.07.2012
Hey guys could you teach me how to make infect cmd? as i am nooooob!!!
Im using zcmd,sscanf2, and YSI\y_timers
Could someone make /infect command for me...with kill timers.
That command should infect the player and he will lose his health for some time till he dies.
Thanks...
Re: Noob... -
Matz - 23.07.2012
pawn Код:
forward Infected(playerid);
public Infected(playerid)
{
SetPlayerHealth(playerid,GetPlayerHealth(playerid)-2);
SetTimerEx("Infected",1000,0,"i",playerid); // -2 hp per second
return 1;
}
CMD:infect(playerid,params[])
{
new targetid;
if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Infect <playerid>");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: Invalid ID.");
else
{
new metin[512];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new target[MAX_PLAYER_NAME];
GetPlayerName(targetid, target, sizeof(target));
SetTimerEx("Infected",100,0,"i",targetid);
format(metin, sizeof(metin), "INFO: You have made %s infected!",target);
SendClientMessage(playerid, -1, metin);
format(metin, sizeof(metin), "WARNING: You have been infected by %s!",name);
SendClientMessage(targetid, -1, metin);
}
return 1;
}
Re: Noob... -
DizzY2306 - 23.07.2012
Thanks...this was helpful.
Re: Noob... -
DizzY2306 - 26.07.2012
There is one problem...after 1 sec it kills me insed of taking 2hp
Re: Noob... -
TaLhA XIV - 26.07.2012
Increase the time of the timer.It would work.
Re: Noob... -
Matz - 26.07.2012
Try like this;
pawn Код:
forward Infected(playerid);
public Infected(playerid)
{
new Float:health; GetPlayerHealth(playerid,health);
SetPlayerHealth(playerid,health-2);
SetTimerEx("Infected",1000,0,"i",playerid); // -2 hp per second
return 1;
}
Re: Noob... -
DizzY2306 - 26.07.2012
Quote:
Originally Posted by Matz
Try like this;
pawn Код:
forward Infected(playerid); public Infected(playerid) { new Float:health; GetPlayerHealth(playerid,health); SetPlayerHealth(playerid,health-2); SetTimerEx("Infected",1000,0,"i",playerid); // -2 hp per second return 1; }
|
Thank you so much!!It finaly works...ive been fuking with this for 4 days lol
Re: Noob... -
doreto - 26.07.2012
Quote:
Originally Posted by DizzY2306
Thank you so much!!It finaly works...ive been fuking with this for 4 days lol
|
You may get fucker for lifetime if you dont use proper title next time
Re: Noob... -
doreto - 26.07.2012
nvm !
Re: Noob... -
DizzY2306 - 26.07.2012
Get a life lul