Help with scripting something - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with scripting something (
/showthread.php?tid=66810)
Help with scripting something -
Ed2ka49 - 24.02.2009
Hey all,
I tried to make a little script that if the player's hp <50 then auto /crack for a 15 seconds,
But I couldn't make that works.
Someone can help me with this thing?
Thanks
Re: Help with scripting something -
Nero_3D - 24.02.2009
pawn Код:
//under OnPlayerUpdate(playerid)
new Float:uhealth;
GetPlayerHealth(playerid, uhealth);
if(uhealth < 50.0) OnPlayerCommandText(playerid, "/crack");
Re: Help with scripting something -
GTAScripter - 24.02.2009
I've got something like this in my script:
Quote:
if(Vehhp <= 400)
{
if(IsPlayerInAnyVehicle(i))
{
TweakCooldown[i] = 3;
if(TweakCooldown[i] == 3)
{
TweakCooldownT[i]++;
CarRunning[VID] = 0;
new newstate;
newstate = GetPlayerState(i);
if(newstate == PLAYER_STATE_DRIVER)
{
TogglePlayerControllable(i,0);
if(TweakCooldownT[i] == 1)
{
SendClientMessage(i, COLOR_RED, " Your car gives out and stops running !");
SendClientMessage(i, COLOR_GREY, " /crack ) ");
TogglePlayerControllable(i,0);
}
if(TweakCooldownT[i] == 10)
{
SendClientMessage(i, COLOR_RED, " Your car gives out and stops running !");
SendClientMessage(i, COLOR_GREY, " /crack ) ");
}
if(TweakCooldownT[i] == 20)
{
SendClientMessage(i, COLOR_RED, " Your car gives out and stops running !");
SendClientMessage(i, COLOR_GREY, " /crack ) ");
TogglePlayerControllable(i,0);
}
}
}
}
}
|
Just adjust it like you want it.
Re: Help with scripting something -
Ed2ka49 - 24.02.2009
I will try both of your suggestions, But WHERE should I put these functions?
Re: Help with scripting something -
GTAScripter - 24.02.2009
Under "Public OnGameModeInit"
Re: Help with scripting something -
c0ke - 18.12.2009
Quote:
Originally Posted by ♣ ⓐⓢⓢ
pawn Код:
//under OnPlayerUpdate(playerid) new Float:uhealth; GetPlayerHealth(playerid, uhealth); if(uhealth < 50.0) OnPlayerCommandText(playerid, "/crack");
|
Alright, Where shall i add this, and is this the only code that shall be added ?
Re: Help with scripting something -
LarzI - 18.12.2009
Quote:
Originally Posted by c0ke
Quote:
Originally Posted by ♣ ⓐⓢⓢ
pawn Код:
//under OnPlayerUpdate(playerid) new Float:uhealth; GetPlayerHealth(playerid, uhealth); if(uhealth < 50.0) OnPlayerCommandText(playerid, "/crack");
|
Alright, Where shall i add this, and is this the only code that shall be added ?
|
Read the comment...
pawn Код:
public OnPlayerUpdate(playerid)
{
new Float:uhealth;
GetPlayerHealth(playerid, uhealth);
if(uhealth < 50.0) OnPlayerCommandText(playerid, "/crack");
return true;
}