SA-MP Forums Archive
Just show me the way to do it - 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: Just show me the way to do it (/showthread.php?tid=87883)



Just show me the way to do it - pierhs - 22.07.2009

I have made many posts about it but I really need it.
I want when one player is killed,he spawns outside in one of the hospitals of LS(random),he will have his controlable set to 0 and his life will increased steadily until it reaches 50%.When it is 50% he will have his controlable set back to 1 so he can leave.Have u ever played the server San Andreas Roleplay?If yes,u will know what I mean.Please help me!!!


Re: Just show me the way to do it - James_Alex - 22.07.2009

juste set a timer of integer as you like
then use "TogglePlayerControllable"
and try this
pawn Код:
hRandom = random(2);
switch(hRandom)
{
  case 1:
  {
     SetPlayerPos(playerid, ...hospital pos);
     TogglePlayerControllable(playerid, 0);
     SetTimerEx("AfterHop", 50000, true, "d", playerid);
  }
  case 2:
  {
     SetPlayerPos(playerid, ...hospital pos);
     TogglePlayerControllable(playerid, 0);
     SetTimerEx("AfterHop", 50000, true, "d", playerid);
  }
}
return 1;
this to spawn in a random hospital


Re: Just show me the way to do it - pierhs - 22.07.2009

Thanks you a lot James but I have some questions.what is 'd' and 'afterhop'?should i put it under onplayerdeath?


Re: Just show me the way to do it - James_Alex - 22.07.2009

no do not do anything
let it like that


Re: Just show me the way to do it - pierhs - 22.07.2009

Thanks you a lot James but I have some questions.what is 'd' and 'afterhop'?should i put it under onplayerdeath?


Re: Just show me the way to do it - James_Alex - 22.07.2009

Quote:
Originally Posted by pierhs
Thanks you a lot James but I have some questions.what is 'd' and 'afterhop'?should i put it under onplayerdeath?
why you're asking the same question ?
i already answred this !!


Re: Just show me the way to do it - Joe Staff - 22.07.2009

No you didn't, AfterHop is the callback he made for when the player has spawned, you put the Switch function under OnPlayerSpawn, you should set the timer to 1000, then in the callback "AfterHop" have it do an 'if' statement to see if the player's health is at 50% or higher, then it would TogglePlayerControllable 0, else it would add player health 1 then do the timer again.

the "d" in the SetTimerEx shows that the next variable is a number and goes into the callback's parameters, in this case "playerid"


Re: Just show me the way to do it - pierhs - 22.07.2009

Can u make this 'if' statement for me please?