Hi, i would like to make a very simple script for samp where i just press f3 and it gives the keys of the cars to the other passengers or to the driver, and i would like it to work even if i'm the driver or the passenger
I can't figure it out where i have missed something
:cmd_givekey
WAIT 0
if key_down 114
then
if 8@ == 0
then
8@ = 2
jump @cmd_gk
end
else
if 8@ == 1
then
0000:
else
8@ = 0
end
end
:cmd_gk
0007: 12@ = 10.0
11@ = -1
Actor.StorePos($PLAYER_ACTOR, 27@, 26@, 25@)
FOR 0@ = 0 to 999
IF SAMP.IsPlayerConnected(0@)
THEN
IF 1@ = SAMP.GetActorHandleByPlayerID(0@)
THEN
IF Actor.Driving(1@)
THEN
2@ = Actor.CurrentCar(1@)
046C: 20@ = car 2@ driver
IF 003B: 20@ == 1@
THEN
Actor.StorePos(1@, 30@, 29@, 28@)
050A: 16@ = distance_between_XYZ 27@ 26@ 25@ and_XYZ 30@ 29@ 28@
IF 0025: 16@ > 12@
THEN
16@ = 0
ELSE
0087: 12@ = 16@
0085: 11@ = 0@
END
END
END
END
END
END
IF 0039: 11@ == -1
THEN
0085: 1@ = 1@
ELSE
0AF9: samp say_msg "/givekey %d" 11@
END
SAMP.CmdRet()
Thank you so much!
I can't figure it out where i have missed something
:cmd_givekey
WAIT 0
if key_down 114
then
if 8@ == 0
then
8@ = 2
jump @cmd_gk
end
else
if 8@ == 1
then
0000:
else
8@ = 0
end
end
:cmd_gk
0007: 12@ = 10.0
11@ = -1
Actor.StorePos($PLAYER_ACTOR, 27@, 26@, 25@)
FOR 0@ = 0 to 999
IF SAMP.IsPlayerConnected(0@)
THEN
IF 1@ = SAMP.GetActorHandleByPlayerID(0@)
THEN
IF Actor.Driving(1@)
THEN
2@ = Actor.CurrentCar(1@)
046C: 20@ = car 2@ driver
IF 003B: 20@ == 1@
THEN
Actor.StorePos(1@, 30@, 29@, 28@)
050A: 16@ = distance_between_XYZ 27@ 26@ 25@ and_XYZ 30@ 29@ 28@
IF 0025: 16@ > 12@
THEN
16@ = 0
ELSE
0087: 12@ = 16@
0085: 11@ = 0@
END
END
END
END
END
END
IF 0039: 11@ == -1
THEN
0085: 1@ = 1@
ELSE
0AF9: samp say_msg "/givekey %d" 11@
END
SAMP.CmdRet()
Thank you so much!
Last edited: