Hello ugbase!
I have a small problem. I tried to create a script that when a player enters in my car, to automatically type /heal [playerid] 1000.
I had some cases. If the player is Paramedic, i need to offer to him heal for only $1.
If that player have enough health (> 95.0) to type "You have enough health!".
But I have a small problem.
My script:
Now, the problem is where i check if the player is in my vehicle, there:
Is there any problem for my script doesn't work?
When I turn on my code, i get this: (see attach)
What I type in chat means: "I can't give you heal, %s, you have enough health. Please get down from the car", but in another language.
My code run for every player, like that verify where i check if the player is in my car (as passenger) doesn't exists.
What's wrong? I can't understand.
Thanks in advice. Sorry for my bad english.
EDIT: I forgot to say something. I tried something. Paramedics, on the server, have that nick color. To check if a player is paramedic I tried to check if his color is like this: "ffff6347". You can see that on the script.
EDIT2: I tried something. Maybe is close to the answer:
In my debug i see this: Why player health is 0.00000?
Why even if i am in a car, 'car' and 'mycar' are 0?
What are the problems?
I have a small problem. I tried to create a script that when a player enters in my car, to automatically type /heal [playerid] 1000.
I had some cases. If the player is Paramedic, i need to offer to him heal for only $1.
If that player have enough health (> 95.0) to type "You have enough health!".
But I have a small problem.
My script:
Rich (BB code):
{$CLEO .cs}
0000: NOP
repeat
wait 0
until 0AFA: is_samp_structures_available
0B34: "tog" @turn
0B34: "heals" @heals
10@ = 0
11@ = 0
12@ = 0
// main loop
while true
wait 0
if 0@ == true
then
for 1@ = 0 to 999
if and
0B23: samp is_player_connected 1@
0B20: samp 2@ = actor_handle_from_samp_playerid 1@
then
00D9: 3@ = actor $PLAYER_ACTOR car
00D9: 4@ = actor 2@ car
0226: 5@ = actor 2@ health
6@ = SAMP.GetPlayerNickname(1@)
0B37: samp 7@ = get_player_color 1@
0AD3: 8@v = format "%x" 7@
if and
003B: 3@ == 4@
003B: 3@ != 0
003B: 4@ != 0
then
if 5@ >= 95
then
0AF9: samp say_msg "You have enough health, %s." 6@
000A: 12@ += 1
wait 10000
else
if 0C29: $NOT_USED = stristr string1 8@v string2 "ffff6347"
then
0AF9: samp say_msg "/heal %d 1" 1@
0AF9: samp say_msg "/cw Thanks, %s!" 6@
000A: 11@ += 1
wait 10000
else
0AF9: samp say_msg "/heal %d 1000" 1@
0AF9: samp say_msg "/cw Thanks, %s for help!" 6@
000A: 10@ += 1
wait 10000
end
end
end
end
end
end
end
:heals
chatmsg " --- Heal Stats --- " -1
chatmsg "Players healed: %d" -1 10@
chatmsg "Paramedics healed: %d" -1 11@
chatmsg "Players that had enough health: %d" -1 12@
SAMP.CmdRet()
// cmd
:turn
0B12: 0@ = 0@ XOR true
if 0@ == true
then
chatmsg "Program turned on." -1
else
chatmsg "Program turned off." -1
end
SAMP.CmdRet()
Now, the problem is where i check if the player is in my vehicle, there:
Code:
if and
003B: 3@ == 4@
003B: 3@ != 0
003B: 4@ != 0
then
Is there any problem for my script doesn't work?
When I turn on my code, i get this: (see attach)
What I type in chat means: "I can't give you heal, %s, you have enough health. Please get down from the car", but in another language.
My code run for every player, like that verify where i check if the player is in my car (as passenger) doesn't exists.
What's wrong? I can't understand.
Thanks in advice. Sorry for my bad english.
EDIT: I forgot to say something. I tried something. Paramedics, on the server, have that nick color. To check if a player is paramedic I tried to check if his color is like this: "ffff6347". You can see that on the script.
EDIT2: I tried something. Maybe is close to the answer:
Code:
{$CLEO .cs}
0000: NOP
repeat
wait 0
until 0AFA: is_samp_structures_available
0B34: "tog" @turn
0B34: "heals" @heals
10@ = 0
11@ = 0
12@ = 0
// main loop
while true
wait 500
if 0@ == true
then
for 1@ = 0 to 999
if and
0B23: samp is_player_connected 1@
0B20: samp 2@ = actor_handle_from_samp_playerid 1@
then
00D9: 3@ = actor $PLAYER_ACTOR car
00D9: 4@ = actor 2@ car
6@ = SAMP.GetPlayerNickname(1@)
0B37: samp 7@ = get_player_color 1@
0AD3: 8@v = format "%x" 7@
0226: 5@ = actor 2@ health
chatmsg "%s (%d) (actorhandle: %d) is streamed (car: %d | mycar: %d | color: %s | health: %d)." -1 6@ 1@ 2@ 4@ 3@ 8@v 5@
if and
003B: 3@ == 4@
0039: 3@ != -1
0039: 4@ != -1
then
if
5@ >= 95.0
then
0AF9: samp say_msg "You have enough health %s." 6@
000A: 12@ += 1
wait 10000
else
if 0C29: $NOT_USED = stristr string1 8@v string2 "ffff6347"
then
0AF9: samp say_msg "/heal %d 1" 1@
0AF9: samp say_msg "/cw Thanks, %s!" 6@
000A: 11@ += 1
wait 10000
else
0AF9: samp say_msg "/heal %d 1000" 1@
0AF9: samp say_msg "/cw Thanks, %s!" 6@
000A: 10@ += 1
wait 10000
end
end
end
end
end
end
end
:heals // in romanian (unused)
chatmsg " --- Statistici heal-uri --- " -1
chatmsg "Puncte la raport obtiunte: %d" -1 10@
chatmsg "Paramedici vindecati: %d" -1 11@
chatmsg "Playeri care aveau destula viata: %d" -1 12@
SAMP.CmdRet()
// cmd
:turn
0B12: 0@ = 0@ XOR true
if 0@ == true
then
chatmsg "Program turned on." -1
else
chatmsg "Program turned off." -1
end
SAMP.CmdRet()
In my debug i see this: Why player health is 0.00000?
Why even if i am in a car, 'car' and 'mycar' are 0?
What are the problems?
Attachments
Last edited: