Wysłany: 2019-02-07, 12:20
Fl!k
Wiek: 26 Na forum: 3592 dni Posty: 162
Piwa : 18
Witam chcia?bym si? spyta? jak zrobi? skrypt na k?adzenie torby r1 na ziemi
mam skrypt na schowek gdzie wyci?gam torbe r1 lecz nie ma tam k?adzenia :?
oto kod na schowek :
frakcja-samd >> s_schowek
function findPlayer ( plr , cel )
local target = nil
if ( tonumber ( cel ) ~= nil ) then
target = getElementByID ( "p" .. cel )
else -- podano fragment nicku
for _ , thePlayer in ipairs ( getElementsByType ( "player" )) do
if string . find ( string . gsub ( getPlayerName ( thePlayer ): lower (), "#%x%x%x%x%x%x" , "" ), cel : lower (), 1 , true ) then
if ( target ) then
outputChatBox ( "Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter." , plr )
return nil
end
target = thePlayer
end
end
end
return target
end
addEvent ( "PRszyny" , true )
addEventHandler ( "PRszyny" , root ,function( el )
if not getElementData ( el , "prm:item:szyny" ) then
local x , y , z = getElementPosition ( el )
local object = createObject ( 3911 , x , y , z )
exports . bone_attach : attachElementToBone ( object , el , 12 , 0 , 0 , 0.22 , 180 , 0 )
setElementData ( el , "prm:item:szyny" , object )
exports [ "noti2" ]: noti ( "Wyci?gasz szyny kramera z ambulansu." , el )
else
destroyElement ( getElementData ( el , "prm:item:szyny" ))
exports [ "noti2" ]: noti ( "Chowasz szyny kramera do ambulansu." , el )
setElementData ( el , "prm:item:szyny" , nil )
end
end )
addEvent ( "PRtorba" , true )
addEventHandler ( "PRtorba" , root ,function( el )
if not getElementData ( el , "prm:item:torba" ) then
local x , y , z = getElementPosition ( el )
local object = createObject ( 1248 , x , y , z )
exports . bone_attach : attachElementToBone ( object , el , 12 , 0.02 , 0.1 , 0.3 , 0 , 180 , 0 )
setElementData ( el , "prm:item:torba" , object )
exports [ "noti2" ]: noti ( "Wyci?gasz torb? medyczn? z ambulansu." , el )
else
destroyElement ( getElementData ( el , "prm:item:torba" ))
exports [ "noti2" ]: noti ( "Chowasz torb? medyczn? do ambulansu." , el )
setElementData ( el , "prm:item:torba" , nil )
end
end )
addEvent ( "PRdeska" , true )
addEventHandler ( "PRdeska" , root ,function( el )
if not getElementData ( el , "prm:item:deska" ) then
local x , y , z = getElementPosition ( el )
local object = createObject ( 1998 , x , y , z )
exports . bone_attach : attachElementToBone ( object , el , 12 , 0.2 ,- 0.1 , 0.4 , 90 , 90 , 90 )
setElementData ( el , "prm:item:deska" , object )
setElementScale ( el , 0.8 )
exports [ "noti2" ]: noti ( "Wyci?gasz z karetki desk? ortopedyczn?." , el )
else
destroyElement ( getElementData ( el , "prm:item:deska" ))
exports [ "noti2" ]: noti ( "Chowasz desk? ortopedyczn? do ambulansu." , el )
setElementData ( el , "prm:item:deska" , nil )
end
end )
-- out
addEvent ( "PRnosze" , true )
addEventHandler ( "PRnosze" , root ,function( el )
if not getElementData ( el , "prm:item:nosze" ) then
local x , y , z = getElementPosition ( el )
local object = createObject ( 1943 , x , y , z )
attachElements ( object , el , 0 , 1 , - 1 , 0 , 0 , 180 )
setElementData ( object , "prm:item:nosze" , el )
setElementData ( el , "prm:item:nosze" , object )
setElementScale ( object , 1.3 )
exports [ "noti2" ]: noti ( "Wysuwasz nosze z ambulansu." , el )
else
destroyElement ( getElementData ( el , "prm:item:nosze" ))
exports [ "noti2" ]: noti ( "Chowasz nosze do ambulansu." , el )
setElementData ( el , "prm:item:nosze" , nil )
end
end )
local PacjeciNaDesce = {}
function onPoliceQuit ( veh )
if getElementData ( source , "temp:tased" ) then
removePedFromVehicle ( getElementData ( source , "temp:tased" ) )
attachElements ( getElementData ( source , "temp:tased" ), source , 1 , 0 , 0 , 0 , 0 , 0 )
end
end
function naNosze ( taseplayer2 , client , pomocnik )
if not PacjeciNaDesce [ taseplayer2 ] and not PacjeciNaDesce [ pomocnik ] then
local object = createObject ( 1998 , 0 , 0 , 0 )
setElementData ( taseplayer2 , "prm:item:deskaNA" , object )
PacjeciNaDesce [ taseplayer2 ] = true
PacjeciNaDesce [ pomocnik ] = true
rot1 , rot2 , rot3 = getElementRotation ( client )
attachElementToElement ( object , client , 0 , 0.9 ,- 0.3 , 0 , 0 , 90 )
attachElementToElement ( pomocnik , client , 0 , 3 , 0 , 0 , 0 , 180 )
attachElementToElement ( taseplayer2 , client , 0 , 1.2 , 0.9 , 0 , 0 , 0 )
setElementData ( client , "temp:tased" , taseplayer2 )
setElementCollisionsEnabled ( taseplayer2 , false )
exports [ "noti2" ]: noti ( "Przenosisz gracza na nosze." , client )
exports [ "noti2" ]: noti ( "Zosta?e? przeniesiony na nosze przez ratownika medycznego." , taseplayer2 )
setPedAnimation ( taseplayer2 , "CRACK" , "crckidle4" , - 1 , true , false )
else
PacjeciNaDesce [ taseplayer2 ] = false
detachElements ( taseplayer2 )
PacjeciNaDesce [ pomocnik ] = false
detachElements ( pomocnik )
setElementData ( client , "temp:tased" , nil )
setElementCollisionsEnabled ( taseplayer2 , true )
setPedAnimation ( taseplayer2 )
destroyElement ( getElementData ( taseplayer2 , "prm:item:deskaNA" ))
exports [ "noti2" ]: noti ( "Chowasz desk? ortopedyczn? do ambulansu." , taseplayer2 )
setElementData ( taseplayer2 , "prm:item:deskaNA" , nil )
end
end
addCommandHandler ( "deska" ,function ( client , cmd , target , pomocnik )
if getElementData ( client , "player:duty" )== "PR" or getElementData ( client , "player:duty" )== "PSP" then
if target and findPlayer ( plr , target ) and pomocnik and findPlayer ( plr , pomocnik ) then
target = findPlayer ( plr , target )
pomocnik = findPlayer ( plr , pomocnik )
if not PacjeciNaDesce [ target ] then
removePedFromVehicle ( target )
removePedFromVehicle ( pomocnik )
naNosze ( target , client , pomocnik )
addEventHandler ( "onPlayerVehicleEnter" , client , onPoliceEnter , false )
addEventHandler ( "onPlayerVehicleExit" , client , onPoliceQuit , false )
else
naNosze ( target , client , pomocnik )
removeEventHandler ( "onPlayerVehicleEnter" , client , onPoliceEnter , false )
removeEventHandler ( "onPlayerVehicleExit" , client , onPoliceQuit , false )
end
end
end
end )
---------------------------
---------------------------
local PacjeciNaNoszach = {}
function tasePlayer2 ( taseplayer2 , client )
if not PacjeciNaNoszach [ taseplayer2 ] then
PacjeciNaNoszach [ taseplayer2 ] = true
setElementFrozen ( taseplayer2 )
rot1 , rot2 , rot3 = getElementRotation ( client )
attachElementToElement ( taseplayer2 , client , 0 , 1 , 1 , 0 , 0 , 180 )
setElementData ( client , "temp:tased" , taseplayer2 )
setElementCollisionsEnabled ( taseplayer2 , false )
exports [ "noti2" ]: noti ( "Przenosisz gracza na nosze." , client )
exports [ "noti2" ]: noti ( "Zosta?e? przeniesiony na nosze przez ratownika medycznego." , taseplayer2 )
setPedAnimation ( taseplayer2 , "CRACK" , "crckidle4" , - 1 , true , false )
else
PacjeciNaNoszach [ taseplayer2 ] = false
detachElements ( taseplayer2 )
setElementData ( client , "temp:tased" , nil )
setElementCollisionsEnabled ( taseplayer2 , true )
setPedAnimation ( taseplayer2 )
end
end
addCommandHandler ( "nosze" ,function ( client , cmd , target )
if getElementData ( client , "player:duty" )== "PR" or getElementData ( client , "player:duty" )== "PSP" then
if target and findPlayer ( plr , target ) then
target = findPlayer ( plr , target )
if not PacjeciNaNoszach [ target ] then
removePedFromVehicle ( target )
tasePlayer2 ( target , client )
addEventHandler ( "onPlayerVehicleEnter" , client , onPoliceEnter , false )
addEventHandler ( "onPlayerVehicleExit" , client , onPoliceQuit , false )
else
tasePlayer2 ( target , client )
removeEventHandler ( "onPlayerVehicleEnter" , client , onPoliceEnter , false )
removeEventHandler ( "onPlayerVehicleExit" , client , onPoliceQuit , false )
end
end
end
end )
Wysłany: 2019-02-07, 16:45
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
Obiekty tworzysz za pomoc?
Je?li chcesz go usun?? u?yj
Dodaj sobie komend? czy bind i przypisz do niego funkcj? pobieraj?c? pozycj? gracza i tworz?c? w pobli?u torb?. Ponowne u?ycie komendy/binda chowa torbe.
Wysłany: 2019-02-07, 18:44
Fl!k
Wiek: 26 Na forum: 3592 dni Posty: 162
Piwa : 18
Ale skrypt na torb? w r?ce posiadam lecz nie posiadam torby aby ja po?o?y? na ziemi
Wysłany: 2019-02-07, 18:53
PatryKK.
Emeryt LUA
Wiek: 26 Na forum: 3061 dni Posty: 1060
Nick w MP: PatryKK.
Piwa : 2322
To Ty masz model torby czy nie?
Podpis
GG:75080675
- ✔
- ✔
- ✔
- ✔
Aktualny projekt: BRAK
Wysłany: 2019-02-07, 19:07
Fl!k
Wiek: 26 Na forum: 3592 dni Posty: 162
Piwa : 18
Mam
[ Dodano : 2019-02-07, 19:08 ]
Tylko chce skrypt zrobi? aby by?o mozna j? po?o?y? na ziemi gdy wyci?gam j? z schowka
Wysłany: 2019-02-07, 19:37
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
No to tw?rz obiekt torby na ziemii , wymagane funkcje do stworzenia i usuni?cia jej ju? Ci wys?a?em:
Wysłany: 2019-02-07, 19:45
Fl!k
Wiek: 26 Na forum: 3592 dni Posty: 162
Piwa : 18
Tylko nie ogarniam zabardzo jak
Wysłany: 2019-02-07, 20:14
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
No to pora si??czego? nauczy? a nie pobiera? gotowe pseudole i oczekiwa? roboty wykonanej przez kogo?.
Poni?ej wysy?am Ci komend? '/obiekt', kt?r? stworzysz obiekt o ID 2872 obok gracza.
Je?li taki obiekt ju? jest, skrypt go usuwa.
local obiekty = {}
function stworzObiekt ( plr )
if ( obiekty [ plr ]) then
destroyElement ( obiekty [ plr ])
obiekty [ plr ] = nil
return
end
local x , y , z = getElementPosition ( plr )
obiekty [ plr ] = createObject ( 2872 , x + 2 , y + 2 , z , 0 , 0 , 0 )
outputChatBox ( "Stworzono obiekt obok Ciebie" , plr )
end
addCommandHandler ( "obiekt" , stworzObiekt )
Zmodyfikujesz, wstawisz w odpowiednie miejsce i ju? masz wyczekiwany efekt.
Wysłany: 2019-02-07, 21:11
Fl!k
Wiek: 26 Na forum: 3592 dni Posty: 162
Piwa : 18
Ale skrypt zebym mia? torbe r1 mam tylko nie ma tam funkcji k?adzenia na pod?odze
Wysłany: 2019-02-07, 21:37
Wilq
Wiek: 24 Na forum: 4429 dni Posty: 3410
Piwa : 739
Torb? tworzysz w evencie "PRtorba".
Wykorzystaj m?j kod, podmie? ID obiektu na torb? i tyle. Wystarczy, ?e to skopiujesz i odpowiednio zmodyfikujesz.
Ile razy mo?na to samo? Nie ma stawiania torby bo jej nie zrobi?e?.
Wys?a?em Ci gotowy kod, u?yj go z g?ow? i osi?gniesz to co chcesz.
Tagi: torba :: psp-r1
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: