Vending Machine Re-Heal
#1

i want to do a filterscript that spawn a vending machine in front of the player when typed /machine and in front of the vending machine will be a Corona (or what is called the red circle where on singleplayer you start missions) and when typed /use reheal the player but him can only spawn a machine every 5 minutes... anyone want help me out?

i will put credits and + rep for sure!

thanx to everyone that will help me out
Reply
#2

a vending machine created with create object and such will crash the player when he uses it with F. i suggest you do that someway diffrent, even though you players have to type a command to heal, some would certainly press F and get crashed :-/

thats only my opinion
Reply
#3

Why not place the vending machine in a certain area like outside the hospital, and when the player transports there he would be healed? Isn't as good as you were wanting but at least it wouldn't crash your game like Falco-Ger said.
Reply
#4

A Healing machine when can be TP'ed anywhere? Thats fucked up lol.

Just make the command /bandage or /healup. It will heal the player. Put a timer as SetTimerEx for the player to make the using variable to 1. And add a check at /bandage or /healup command which checks for that variable is 0 or not. If it is 0 it will work. If it is not zero then will show a error message. Add a timer to set the variable to 0 after 5 mins.
Reply
#5

Pressing F at created vending machines does not crash you at all.

Create it with CreateObject
Use IsPlayerInRangeOfPoint under OnPlayerKeyStateChange to detect the players action
Reply
#6

Thanx at all! how to spawn a Checkpoint i don't remember the callback :/
Reply
#7

Well if you want to use a checkpoint fine, but personally I'd either create an invisible pickup or use OnPlayerKeyStateChange with KEY_SECONDARY_ATTACK (enter/F).

https://sampwiki.blast.hk/wiki/SetPlayerCheckpoint

you'll want a streamer though.
https://sampforum.blast.hk/showthread.php?tid=102865
Reply
#8

hmmm. too much work for a beginner like me using checkpoints... instead using pickups is more easy? how is the code to add when player is on pickup and use KEY_SECONDARY_ATTACK use the vending machine, reheal him and the player lose 1000$ ? thanx for help
Reply
#9

ok i've put the machines at each hospital and put in front of them the checkpoint.. now i want to do like this but i don't know very well the if statement.. i have this code

Quote:

public OnPlayerEnterCheckpoint(playerid)
{

GivePlayerMoney(playerid, -1000);
SetPlayerHealth(playerid, 100);
return 1;
}

i want to do this thing (i wrtite it like i would like to do)

Quote:

public OnPlayerEnterCheckpoint(playerid)
{
if(PlayerMoney < 1000) SendClientMessage(playerid, 0x800080AA, "You don't have much money!!"); else
GivePlayerMoney(playerid, -1000);
SetPlayerHealth(playerid, 100);
return 1;
if(PlayerHealth = 100) SendClientMessage(playerid, 0x800080AA, "Your life is full!!"); else
GivePlayerMoney(playerid, -1000);
SetPlayerHealth(playerid, 100);
return 1;
}

I know this is an wrong code but this is what i would like to have... anyone can help me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)