Noob...
#1

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...
Reply
#2

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;
}
Reply
#3

Thanks...this was helpful.
Reply
#4

There is one problem...after 1 sec it kills me insed of taking 2hp
Reply
#5

Increase the time of the timer.It would work.
Reply
#6

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;
}
Reply
#7

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
Reply
#8

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
Reply
#9

nvm !
Reply
#10

Get a life lul
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)