Szerző Téma: /2 kérdés/ 1. Jármû respawn 2. fura hibák  (Megtekintve 549 alkalommal)

Nem elérhető Flash

  • 5726
  • (っ◕‿◕)っ
    • Profil megtekintése
/2 kérdés/ 1. Jármû respawn 2. fura hibák
« Dátum: 2012. november 24. - 09:03:08 »
0 Show voters
Üdv :)
1.
  Azt szeretném megcsinálni, hogy van a szerveremen egy jármû respawner ami 5 percenként respawnolja a használaton kívüli jármûveket, és azt szeretném, hogy a bónuszautót, és az Export jármûveket ne respawnolja, mert eltûnik felette a nyíl.
2.
   Fura hibák ír a fekete ablak.
 
----------
Loaded log file: \"server_log.txt\".
----------
SA-MP Dedicated Server
----------------------
v0.3e, ©2005-2012 SA-MP Team
[09:01:35]
[09:01:35] Server Plugins
[09:01:35] --------------
[09:01:35]  Loading plugin: streamer
[09:01:35]
*** Streamer Plugin v2.6.1 by Incognito loaded ***
[09:01:35]   Loaded.
[09:01:35]  Loading plugin: sscanf
[09:01:35]
[09:01:35]  ===============================
[09:01:35]       sscanf plugin loaded.     
[09:01:35]    © 2009 Alex \"Y_Less\" Cole
[09:01:35]    0.3d-R2 500 Players \"dnee\"
[09:01:35]  ===============================
[09:01:35]   Loaded.
[09:01:35]  Loading plugin: mysql
[09:01:35]
  > MySQL plugin R5 successfully loaded.
[09:01:35]   Loaded.
[09:01:35]  Loading plugin: gvar
[09:01:35]
*** GVar Plugin v1.3 by Incognito loaded ***
[09:01:35]   Loaded.
[09:01:35]  Loading plugin: crashdetect
[09:01:35]   crashdetect v4.8.3 is OK.
[09:01:35]   Loaded.
[09:01:35]  Loaded 5 plugins.
[09:01:35]
[09:01:35] Filterscripts
[09:01:35] ---------------
[09:01:35]   Loading filterscript \'TD.amx\'...
[09:01:35]
--------------------------------------
[09:01:35]  Text Draw Editor 1.0RC2 by Zamaroht for SA-MP 0.3 betöltve.
[09:01:35] --------------------------------------
[09:01:35]   Loading filterscript \'Fallout.amx\'...
[09:01:35]   Loading filterscript \'Objects.amx\'...
[09:01:35]   Loading filterscript \'Export.amx\'...
[09:01:35]   Loaded 4 filterscripts.
[09:01:35] Szerver betöltése folyamatban..
[09:01:35] Szerverre regisztráltak száma: 5
[09:01:35]
Objectek száma: 8650
[09:01:35] Sikeres mysql csatlakozás: localhost
[09:01:35] A szerveren sikeresen betöltött 0.016 másodperc alatt!
[09:01:35] Sikeresen betöltve 62 darab jármû!
[09:01:35] Number of vehicle models: 29
[09:01:57] Incoming connection: 89.134.51.148:3001
[09:01:57] [join] Flash has joined the server (0:89.134.51.148)
[09:02:06] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:06] [debug]  Accessing element at negative index -400
[09:02:06] [debug] AMX backtrace:
[09:02:06] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:07] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:07] [debug]  Accessing element at negative index -400
[09:02:07] [debug] AMX backtrace:
[09:02:07] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:08] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:08] [debug]  Accessing element at negative index -400
[09:02:08] [debug] AMX backtrace:
[09:02:08] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:10] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:10] [debug]  Accessing element at negative index -400
[09:02:10] [debug] AMX backtrace:
[09:02:10] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:11] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:11] [debug]  Accessing element at negative index -400
[09:02:11] [debug] AMX backtrace:
[09:02:11] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:11] [debug] Run time error 4: \"Array index out of bounds\"
[09:02:11] [debug]  Accessing element at negative index -400
[09:02:11] [debug] AMX backtrace:
[09:02:11] [debug] #0 0002e840 in public OnPlayerUpdate () from FeW.amx
[09:02:12] Sikeresen elmentõdtek Flash statisztikái!
[09:02:12] [part] Flash has left the server (0:1)
[09:02:14] --- Server Shutting Down.
[09:02:14]
*** Streamer Plugin v2.6.1 by Incognito unloaded ***
[09:02:14]
[09:02:14]  ===============================
[09:02:14]      sscanf plugin unloaded.   
[09:02:14]  ===============================
[09:02:14]
  > MySQL plugin unloaded.
[09:02:14]
*** GVar Plugin v1.3 by Incognito unloaded ***
 
[/quote]


Aki segít megy a +.
« Utoljára szerkesztve: 2012. november 24. - 10:58:11 írta Flash »

/2 kérdés/ 1. Jármû respawn 2. fura hibák
« Válasz #1 Dátum: 2012. november 24. - 10:18:57 »
+1 Show voters
Elsõ:
 
function VehicleRespawn() {
for(new i; i < MAX_VEHICLES; i++) {
    if(i == bónuszjármûid || i == exportjármûid) continue;
if(!IsVehicleOccupied(i)) {
   SetVehicleToRespawn(i);
}
}
SendClientMessageToAll(LightBlue, \"Minden használaton kívüli jármû az eredeti helyére spawnolva!\");
return 1;
}

 
a bónuszjármûid, és az exportjármûid változókat cseréld ki a változóra, amit a bónusz, ileltve az export jármûvekhez használsz. ha ModelID alapján választod ki ezeket, akkor használhatsz GetVehicleModel(i) függvényt is.


Második:
Van valami hiba az OnPlayerUpdate függvényed alatt, ami miatt laggol, illetve kifagy a mod.
Másold be az OnPlayerUpdate-t

Nem elérhető Flash

  • 5726
  • (っ◕‿◕)っ
    • Profil megtekintése
/2 kérdés/ 1. Jármû respawn 2. fura hibák
« Válasz #2 Dátum: 2012. november 24. - 10:57:14 »
0 Show voters
public
OnPlayerUpdate(playerid) {
IsPlayerHealthChanged(playerid);
new Float:vHealth, Float:Speedo, sString[256];
GetVehicleHealth(GetPlayerVehicleID(playerid), vHealth);
Speedo = GetPlayerSpeed(playerid);
new ss = floatround(Speedo);
if(GetPVarInt(playerid, \"Speedo\")) {
format(sString, sizeof(sString), \"~b~~h~Jármû: ~w~%s~n~~y~~h~Jármû élet: ~w~%.2f~n~~r~~h~Sebesség: ~w~%d km/h\", VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400], vHealth, ss);
TextDrawSetString(SpeedoMeter[playerid][1], sString);
}
return 1;
}

 
IsPlayerHealthChanged:
 
stock IsPlayerHealthChanged(playerid) {
new Float:health[MAX_PLAYERS][2];
GetPlayerHealth(playerid, health[playerid][1]);
    if(health[playerid][0] -health[playerid][1] > 0) {
GangZoneShowForPlayer(playerid, dmgzone, 0xFF0000AA);
}else{
   GangZoneHideForPlayer(playerid, dmgzone);
}
      health[playerid][0] = health[playerid][1];
      return 1;
}

/2 kérdés/ 1. Jármû respawn 2. fura hibák
« Válasz #3 Dátum: 2012. november 24. - 11:35:21 »
+1 Show voters
az IsPlayerHealthChanged függvényed alapban hibás, mert lokális változót használsz, amit minden OnPlayerUpdate lekérésnél felveszel, és az elsõ részére hivatkozol, ami mindig 0, mert akkor vetted fel
A második, hogy a Speedo változód Float, a GetPlayerSpeed függvény általában integerrel tér vissza, és a stringben is integert használsz.
az ss változós floatround függvény felesleges, mert mint mondtam, integerrel tér vissza, amit felesleges kerekíteni, mert a 50.000 ugyanúgy 50 lesz.

Nem elérhető Flash

  • 5726
  • (っ◕‿◕)っ
    • Profil megtekintése
/2 kérdés/ 1. Jármû respawn 2. fura hibák
« Válasz #4 Dátum: 2012. november 24. - 12:28:17 »
0 Show voters
Te vagy az én malackám. :$ xd

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal