Two questions about Scripting Commands and Tut. -
yaron0600 - 27.04.2013
Hey I want to create for my server /piss system that if u wont do that every 30/40 minutes u'll get -5 health .
How can I create a Timer for that ?
And somone can give me good tutorial for make tutorial for my server with cameras moves etc , Ty so much.
Re: Two questions about Scripting Commands and Tut. -
Tamer - 27.04.2013
You may use this for camera mover:
http://forum.sa-mp.com/showthread.ph...t=camera+mover
Re: Two questions about Scripting Commands and Tut. -
Isolated - 27.04.2013
pawn Код:
SetTimerEx(func, time, repeat, "d", playerid);
You'll need to fill the rest in.
Re: Two questions about Scripting Commands and Tut. -
yaron0600 - 27.04.2013
Quote:
Originally Posted by Isolated
pawn Код:
SetTimerEx(func, time, repeat, "d", playerid);
You'll need to fill the rest in.
|
Yeah but how to define this in the command for example what is Func and repeat ? and "d"
Re: Two questions about Scripting Commands and Tut. -
verlaj - 27.04.2013
https://sampwiki.blast.hk/wiki/SetTimerEx
you can also use
pawn Код:
new healthTimer;
new piss[MAX_PLAYERS];
public OnGameModeInit()
{
healthTimer = SetTimer("HealthTimer", 400000, true);
SetTimer("pissoff",200000,true);
return 1;
}
forward pissoff(playerid);
public pissoff(playerid)
{
piss[playerid] = 0; // not sure if it will work with everyone so try adding if (GetPlayerHealth(playerid) >= 1 && GetPLayerHealth(playerid) <= 100) above the piss[playerid] = 0; with brakets == { }
return 1;
}
CMD:piss(playerid,params[])
{
piss[playerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, "you have pissed hard");
return 1;
}
forward HealthTimer(playerid);
public HealthTimer(playerid)
{
if(piss[playerid] == 0)
{
if (GetPlayerHealth(playerid) >= 1 && GetPLayerHealth(playerid) <= 5)
{
SetPlayerHealth(playerid, 0);
}
else if (GetPlayerHealth(playerid) >= 6 && GetPLayerHealth(playerid) <= 10)
{
SetPlayerHealth(playerid, 4);
}
else if (GetPlayerHealth(playerid) >= 11 && GetPLayerHealth(playerid) <= 15)
{
SetPlayerHealth(playerid, 6);
}
else if (GetPlayerHealth(playerid) >= 16 && GetPLayerHealth(playerid) <= 20)
{
SetPlayerHealth(playerid, 11);
}
else if (GetPlayerHealth(playerid) >= 21 && GetPLayerHealth(playerid) <= 25)
{
SetPlayerHealth(playerid, 16);
}
else if (GetPlayerHealth(playerid) >= 26 && GetPLayerHealth(playerid) <= 30)
{
SetPlayerHealth(playerid, 21); // keep on doing this
}
}
else if (piss[playerid] == 1)
{
// do something here
}
return 1;
}
Re: Two questions about Scripting Commands and Tut. -
yaron0600 - 27.04.2013
Quote:
Originally Posted by verlaj
https://sampwiki.blast.hk/wiki/SetTimerEx
you can also use
pawn Код:
new healthTimer; new piss[MAX_PLAYERS];
public OnGameModeInit() { healthTimer = SetTimer("HealthTimer", 400000, true); SetTimer("pissoff",200000,true); return 1; }
forward pissoff(playerid); public pissoff(playerid) { piss[playerid] = 0; // not sure if it will work with everyone so try adding if (GetPlayerHealth(playerid) >= 1 && GetPLayerHealth(playerid) <= 100) above the piss[playerid] = 0; with brakets == { } return 1; }
CMD:piss(playerid,params[]) { piss[playerid] = 1; SendClientMessage(playerid, COLOR_GREEN, "you have pissed hard"); return 1; }
forward HealthTimer(playerid); public HealthTimer(playerid) { if(piss[playerid] == 0) { if (GetPlayerHealth(playerid) >= 1 && GetPLayerHealth(playerid) <= 5) { SetPlayerHealth(playerid, 0); } else if (GetPlayerHealth(playerid) >= 6 && GetPLayerHealth(playerid) <= 10) { SetPlayerHealth(playerid, 4); } else if (GetPlayerHealth(playerid) >= 11 && GetPLayerHealth(playerid) <= 15) { SetPlayerHealth(playerid, 6); } else if (GetPlayerHealth(playerid) >= 16 && GetPLayerHealth(playerid) <= 20) { SetPlayerHealth(playerid, 11); } else if (GetPlayerHealth(playerid) >= 21 && GetPLayerHealth(playerid) <= 25) { SetPlayerHealth(playerid, 16); } else if (GetPlayerHealth(playerid) >= 26 && GetPLayerHealth(playerid) <= 30) { SetPlayerHealth(playerid, 21); // keep on doing this } } else if (piss[playerid] == 1) { // do something here } return 1; }
|
Ty but I didnt got this code with the // u wrote me why and what do u mean ?
Код:
forward pissoff(playerid);
public pissoff(playerid)
{
piss[playerid] = 0; // not sure if it will work with everyone so try adding if (GetPlayerHealth(playerid) >= 1 && GetPLayerHealth(playerid) <= 100) above the piss[playerid] = 0; with brakets == { }
return 1;
}
Re: Two questions about Scripting Commands and Tut. -
verlaj - 27.04.2013
i meant, if that code isn't suppose to be working then use this
pawn Код:
forward pissoff(playerid);
public pissoff(playerid)
{
if(GetPlayerHealth(playerid) >= 1 && GetPLayerHealth(playerid) <= 100)
{
piss[playerid] = 0;
}
return 1;
}
Re: Two questions about Scripting Commands and Tut. -
yaron0600 - 27.04.2013
One last thing here
Код:
forward HealthTimer(playerid);
public HealthTimer(playerid)
{
if(piss[playerid] == 0)
{
if (SetPlayerHealth(playerid) >= 1 && SetPlayerHealth(playerid) <= 5)
{
SetPlayerHealth(playerid, 0);
}
else if (SetPlayerHealth(playerid) >= 6 && SetPlayerHealth(playerid) <= 10)
{
SetPlayerHealth(playerid, 4);
}
else if (SetPlayerHealth(playerid) >= 11 && SetPlayerHealth(playerid) <= 15)
{
SetPlayerHealth(playerid, 6);
}
else if (SetPlayerHealth(playerid) >= 16 && SetPlayerHealth(playerid) <= 20)
{
SetPlayerHealth(playerid, 11);
}
else if (SetPlayerHealth(playerid) >= 21 && SetPlayerHealth(playerid) <= 25)
{
SetPlayerHealth(playerid, 16);
}
else if (SetPlayerHealth(playerid) >= 26 && SetPlayerHealth(playerid) <= 30)
{
SetPlayerHealth(playerid, 21);
}
}
else if (piss[playerid] == 1)
{
SetPlayerHealth(playerid, 50);
}
return 1;
}
In that last lines here :
Код:
else if (piss[playerid] == 1)
{
SetPlayerHealth(playerid, 50);
}
return 1;
How can I change SetPlayerHealth(playerid, %d); U know for set his health to just stay that , I mean if he got -5 health and now he has 95 health precent than if he /piss how can I do it will stay 95 precent... ? ? ?
Re: Two questions about Scripting Commands and Tut. -
verlaj - 27.04.2013
hmm what ? :P
you want to create a string ? rather than using the above code ?
Re: Two questions about Scripting Commands and Tut. -
verlaj - 27.04.2013
use this code
didn't tested but it should work
pawn Код:
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health - 5.0);