Tematy otagowane jako: wykonuje
1. Funkcja wykonuje sie 2 razy
Witam mam problem z funkcja kt?ra wykonuje sie 2 razy a nie powinna. By? bym wdzi?czny za pomoc.
function onClientColShapeHit0d ()
local veh = getPedOccupiedVehicle ( localPlayer )
if not veh then return end
if getElementModel ( veh ) ~= 455 then return end
if not getElementData ( veh , "DajZieloneSwiatlo" ) == true then return end
if getElementData ( veh , "kilometry_ods" ) == 0 then outputChatBox ( "Nie masz wyp?aty do odebrania." ) return end
local ladunek = getElementData ( veh , "kilometry_ods" )
local wyplata = ladunek * 20
triggerServerEvent ( "GiveOddsnieg" , getRootElement (), localPlayer , ladunek , wyplata )
end
addEventHandler ( "onClientColShapeHit" , root , onClientColShapeHit0d )
2. Komenda sie nie wykonuje
Cze??, mam ma?y problem, ot?? komenda si? nie wykonuje. Oto kod:
addCommandHandler ( "parkuj" , function( plr , cmd )
local veh = getPedOccupiedVehicle ( plr )
local vid = getElementData ( vid , "privcar:uid" )
if vid then
if getElementData ( veh , "privcar:owner" ) == getElementData ( plr , "player:uid" ) then
local x , y , z = getElementPosition ( veh )
local rx , ry , rz = getElementRotation ( veh )
local query = exports . db : dbSet ( "UPDATE privcars SET pos='%.2f,%.2f,%.2f,%.2f,%.2f,%.2f' WHERE uid='%d'" , x , y , z , rx , ry , rz , vid )
if query then
outputChatBox ( "Zaparkowa?e? pojazd!" , plr , 0 , 255 , 0 )
else
outputChatBox ( "Nie uda?o si? zaprawkowa? pojazdu..." , plr , 255 , 0 , 0 )
end
else
outputChatBox ( "Pojazd nie nalezy do ciebie!" , plr , 255 , 0 , 0 )
end
else
outputChatBox ( "Pojazd nie jest prywatny!" , plr , 255 , 0 , 0 )
end
end )
DB3 nie pluje nic, w konsoli czystka.
Chcia?bym zapisa? pozycj? pojazdu do bazy, w kt?rej mam "pos", kt?ry jest TEXT'em o d?ugo?ci 600
3. Zle sie wykonuje
Mam problem z streamerem, zawsze wykonuje sie ten sam checkpoint pomocy!
[pawn]
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == PracaSklep0[playerid])
{
DestroyDynamicCP(PracaSklep0[playerid]);
new box = random(3);
if(box == 0)
{
SetPlayerAttachedObject(playerid, 5, 19638, 5, 0.1, 0, 0.2, -90, 0, 0);
}
if(box == 1)
{
SetPlayerAttachedObject(playerid, 5, 19636, 5, 0.1, 0, 0.2, -90, 0, 0);
}
if(box == 2)
{
SetPlayerAttachedObject(playerid, 5, 2969, 5, 0.1, 0, 0.2, -90, 0, 0);
}
print("Dano cp");
PracaSklep1[playerid] = CreateDynamicCP(243.7237,-45.6671,1.5853, 1, -1, 0, playerid, 50);
return 1;
}
if(checkpointid == PracaSklep1[playerid])
{
DestroyDynamicCP(PracaSklep1[playerid]);
GivePlayerMoney(playerid, 3);
RemovePlayerAttachedObject(playerid, 5);
PracaSklep2[playerid] = CreateDynamicCP(255.8060,-54.3830,1.5703, 1, -1, 0, playerid, 50);
return 1;
}
if(checkpointid == PracaSklep2[playerid])
{
DestroyDynamicCP(PracaSklep2[playerid]);
new box = random(3);
if(box == 0)
{
SetPlayerAttachedObject(playerid, 5, 19638, 5, 0.1, 0, 0.2, -90, 0, 0);
}
if(box == 1)
{
SetPlayerAttachedObject(playerid, 5, 19636, 5, 0.1, 0, 0.2, -90, 0, 0);
}
if(box == 2)
{
SetPlayerAttachedObject(playerid, 5, 2969, 5, 0.1, 0, 0.2, -90, 0, 0);
}
PracaSklep3[playerid] = CreateDynamicCP(245.6620,-43.4706,1.5853, 1, -1, 0, playerid, 50);
...
4. Kod w konsoli wykonuje się 2 razy
Nie wiem, czy kto? spotka? si? z podobnym problemem, ale m?j kod w konsoli wykonuje si? dwa razy. Dok?adnie chodzi o MySQL, u?ywam includa i pluginu od BlueG. Jest to cholerny problem, poniewa? podczas wczytywania pojazd?w, wczytuj? si? one dwa razy. My?la?em na pocz?tku, ?e to co? z kodem, ale nie. Stworzy?em nowy plik, napisa?em funkcj? wy?wietlaj?c? czy po??czenie z baz? danych si? uda?o i oczywi?cie wy?wietla si? dwa razy. Przeszukiwa?em forum samp'a, ale nie znalaz?em czego? takiego u nikogo.
Tutaj server log:
Kod: SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team
[20] filterscripts = "" (string)
[20]
[20] Server Plugins
[20] --------------
[20] Loading plugin: mysql
[20] >> plugin.mysql: R41-2 successfully loaded.
[20] Loaded.
[20] Loading plugin: crashdetect
[20] CrashDetect v4.18 is OK.
[20] Loaded.
[20] Loaded 2 plugins.
[20]
[20] Filterscripts
[20] ---------------
[20] Loaded 0 filterscripts.
[20] Polaczono z MYSQL
[20] Polaczono z MYSQL
[20] Number of vehicle models: 0
@edit w mysql log po??czenie z baz? danych r?wnie? wyst?puje dwa razy
5. Animacja peda sie nie wykonuje
Witam tak jak wy?ej kod:
function sped ()
pedo = createPed ( 120 , - 2292.09 , 140.69 , 35.31 )
setPedAnimation ( pedo , "BEACH" , "ParkSit_M_loop" )
end
addEventHandler ( "onResourceStart" , resourceRoot , sped )