SetTimer(\"HPle\", 1000, true); //1 másodpercenként fog lefutni a timer GameModeInit alánew HPTIMER_PLR[MAX_PLAYERS];forward HPle(playerid);public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid){new Float:HP[MAX_PLAYERS];GetPlayerHealth(damagedid, HP[damagedid]);if(HP[damagedid] <= 90){HPTIMER_PLR[playerid] = 1;}return 1;}public HPle(playerid){new Float:HP[MAX_PLAYERS];if(HPTIMER_PLR[playerid] == 1){GetPlayerHealth(HPTIMER_PLR[playerid], HP[playerid]);SetPlayerHealth(HPTIMER_PLR[playerid], HP[playerid]-1);}return 1;}CMD:ellatas(playerid, params[]){HPTIMER_PLR[playerid] = 0;return 1;}
Sscanf2 szükséges hozzá: SetTimer(\"HPle\", 1000, true); //1 másodpercenként fog lefutni a timer GameModeInit alánew HPTIMER_PLR[MAX_PLAYERS];forward HPle(playerid);public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid){new Float:HP[MAX_PLAYERS];GetPlayerHealth(damagedid, HP[damagedid]);if(HP[damagedid] <= 90){HPTIMER_PLR[playerid] = 1;}return 1;}public HPle(playerid){new Float:HP[MAX_PLAYERS];if(HPTIMER_PLR[playerid] == 1){GetPlayerHealth(HPTIMER_PLR[playerid], HP[playerid]);SetPlayerHealth(HPTIMER_PLR[playerid], HP[playerid]-1);}return 1;}CMD:ellatas(playerid, params[]){HPTIMER_PLR[playerid] = 0;return 1;}
new Float:HP[MAX_PLAYERS];
Sscanf2 szükséges hozzá: SetTimer(\"HPle\", 1000, true); //1 másodpercenként fog lefutni a timer GameModeInit alánew HPTIMER_PLR[MAX_PLAYERS];forward HPle(playerid);public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid){new Float:HP[MAX_PLAYERS];GetPlayerHealth(damagedid, HP[damagedid]);if(HP[damagedid] <= 90){HPTIMER_PLR[playerid] = 1;}return 1;}public HPle(playerid){new Float:HP[MAX_PLAYERS];if(HPTIMER_PLR[playerid] == 1){GetPlayerHealth(HPTIMER_PLR[playerid], HP[playerid]);SetPlayerHealth(HPTIMER_PLR[playerid], HP[playerid]-1);}return 1;}CMD:ellatas(playerid, params[]){HPTIMER_PLR[playerid] = 0;return 1;} Ez minek MAX_PLAYERS, mindkét helyen? new Float:HP[MAX_PLAYERS]; [/quote]\"public HPle(playerid)\"alatt nem kell az szerintem.
SetTimer(\"HPle\", 1000, true); //1 másodpercenként fog lefutni a timer GameModeInit alánew HPTIMER_PLR[MAX_PLAYERS];forward HPle();public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid){ new Float:HP[MAX_PLAYERS]; GetPlayerHealth(damagedid, HP[damagedid]); if(HP <= 90) { HPTIMER_PLR[damagedid] = 1; } return 1;}public HPle(){ new Float:HP[MAX_PLAYERS]; for(new i = 0; i < MAX_PLAYERS;i++) { if(HPTIMER_PLR == 1) { GetPlayerHealth(HPTIMER_PLR, HP); SetPlayerHealth(HPTIMER_PLR, HP-1); } } return 1;}CMD:ellatas(playerid, params[]){ HPTIMER_PLR[playerid] = 0; return 1;}
kezdõnek mondanám magam inkább.. :/Azért volt ott, hogy valaki belekössön...rájöttem hogy miért nem jó ha minden igaz: SetTimer(\"HPle\", 1000, true); //1 másodpercenként fog lefutni a timer GameModeInit alánew HPTIMER_PLR[MAX_PLAYERS];forward HPle();public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid){ new Float:HP[MAX_PLAYERS]; GetPlayerHealth(damagedid, HP[damagedid]); if(HP <= 90) { HPTIMER_PLR[damagedid] = 1; } return 1;}public HPle(){ new Float:HP[MAX_PLAYERS]; for(new i = 0; i < MAX_PLAYERS;i++) { if(HPTIMER_PLR == 1) { GetPlayerHealth(HPTIMER_PLR, HP); SetPlayerHealth(HPTIMER_PLR, HP-1); } } return 1;}CMD:ellatas(playerid, params[]){ HPTIMER_PLR[playerid] = 0; return 1;} KÖZBEN ÚJÍTOTTAM
SetTimer(\"HPle\", 1000, true); //1 másodpercenként fog lefutni a timer OnGameModeInit alánew bool:HPTIMER_PLR[MAX_PLAYERS];forward HPle();public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid){new Float:HP;GetPlayerHealth(damagedid, HP);if(HP <= 90) /*if(floatcmp(90, HP) == 1)*/ { HPTIMER_PLR[damagedid] = true; }return 1;} public HPle(){new Float:HP;for(new i = 0; i < MAX_PLAYERS;i++){ if(IsPlayerConnected(i)) { if(HPTIMER_PLR) { GetPlayerHealth(i, HP); // floatsub(HP, -1.0); SetPlayerHealth(i, HP); SetPlayerHealth(i, HP - 1); } }}return 1;} CMD:ellatas(playerid, params[]){HPTIMER_PLR[playerid] = false;return 1;}
Elnézést, hogy beleszólok, de ez így nem csak akkor fog mûködni, ha egyik játékos sebzi meg a másikat? Tehát ha leesik stb., akkor nem lesz jó.
SetTimer(\"HPle\", 1000, true); //1 másodpercenként fog lefutni a timer GameModeInit alá new HPTIMER_PLR[MAX_PLAYERS]; forward HPle(); public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid) { new Float:HP[MAX_PLAYERS]; GetPlayerHealth(playerid, HP[playerid]); if(HP[playerid] <= 90.0) { print(\"sebzést kapott\"); HPTIMER_PLR[playerid] = 1; print(\"változó = 1\"); } return 1; } public HPle() { print(\"lefutott\"); new Float:HP[MAX_PLAYERS]; for(new i = 0; i < 10;i++) { print(\"ciklus elindult\"); if(HPTIMER_PLR == 1) { print(\"belépett a nullás idbe\"); GetPlayerHealth(i, HP); SetPlayerHealth(i, HP-1); print(\"megváltoztatta a hp-t\"); } } return 1; } CMD:ellatas(playerid, params[]) { HPTIMER_PLR[playerid] = 0; return 1; }