Just show me the way to do it
#1

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

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

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

no do not do anything
let it like that
Reply
#5

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)