#include <a_samp>#include <zcmd>#include <sscanf2>#define PRESSED(%0) \\(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))enum jatekosAdat{jEhes,jSzomjas};new jAdat[MAX_PLAYERS][jatekosAdat];forward EhsegText(playerid);forward SzomjusagText(playerid);new EhsegLevon[MAX_PLAYERS];new SzomjLevon[MAX_PLAYERS];forward EhesTimer();forward SzomjTimer();#if defined FILTERSCRIPTpublic OnFilterScriptInit(){print(\"\\n--------------------------------------\");print(\" Blank Filterscript by your name here\");print(\"--------------------------------------\\n\");return 1;}public OnFilterScriptExit(){return 1;}#elsemain(){print(\"\\n----------------------------------\");print(\" Blank Gamemode by your name here\");print(\"----------------------------------\\n\");}#endifpublic OnGameModeInit(){// Don\'t use these lines if it\'s a filterscriptSetGameModeText(\"Blank Script\");AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);return 1;}public OnGameModeExit(){return 1;}public OnPlayerRequestClass(playerid, classid){SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);return 1;}public OnPlayerConnect(playerid){jAdat[playerid][jEhes] = 98; //loginnál átváltjajAdat[playerid][jSzomjas] = 98; //loginnál átváltja EhsegText();SzomjusagText();return 1;}new id;CMD:ehesszomjas(playerid,params[]){ new ehes= jAdat[playerid][jEhes]; new szomjas= jAdat[playerid][jSzomjas]; new string[60]; format(string, sizeof string, \"Éhség: %d %\\nSzomjúság: %d %\", ehes, szomjas); ShowPlayerDialog(playerid,6,DIALOG_STYLE_MSGBOX,\"Energia\",string,\"Ok\",\"\"); return 1;}CMD:ehes(playerid, params[]){new Szazalek;if(sscanf(params, \"ud\", id, Szazalek)) return SendClientMessage(playerid, 0xAA3333AA, \"***/éhség < ID > < Százalék >\");if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xAA3333AA, \"A játékos nem elérhető!\");SendClientMessage(playerid, 0xAA3333AA, \"Beállítottad a játékos éhség szintjét!\");SendClientMessage(id, 0xAA3333AA, \"Valaki beállította az éhség szinted!\");jAdat[playerid][jEhes] += Szazalek;return 1;}CMD:szomjas(playerid, params[]){new Szazalek;if(sscanf(params, \"ud\", id, Szazalek)) return SendClientMessage(playerid, 0xAA3333AA, \"***/szomjúság < Id > < Százalék >\");if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xAA3333AA, \"A játékos nem elérhető!\");SendClientMessage(playerid, 0xAA3333AA, \"Beállítottad a játékos szomjúság szintjét!\");SendClientMessage(id, 0xAA3333AA, \"Valaki beállította a szomjúság szinted!\");jAdat[playerid][jSzomjas] += Szazalek;return 1;}CMD:me(playerid, params[]){ new string[128];new neve[MAX_PLAYER_NAME]; GetPlayerName(playerid, neve, MAX_PLAYER_NAME); if(isnull(params)) return SendClientMessage(playerid, 0xAA3333AA, \"***: /me < Cselekvés >\"); format(string, sizeof(string), \"Cselekvés: %s %s\", neve, params); SendClientMessageToAll(-1, string); return 1;}CMD:szenya(playerid){if(jAdat[playerid][jEhes] == 100) return SendClientMessage(playerid,0xAA3333AA,\"Nem vagy éhes!\");jAdat[playerid][jEhes] += 30;SendClientMessage(playerid,0xAA3333AA,\"Megettél egy szenyát!\");return 1;}CMD:szoda(playerid){if(jAdat[playerid][jSzomjas] == 100) return SendClientMessage(playerid,0xAA3333AA,\"Nem vagy szomjas!\");jAdat[playerid][jSzomjas] += 30;SendClientMessage(playerid,0xAA3333AA,\"Ittál egy kis szódát!\");return 1;}public OnPlayerDisconnect(playerid, reason){ KillTimer(EhsegLevon[playerid]); KillTimer(SzomjLevon[playerid]);return 1;}public OnPlayerSpawn(playerid){EhsegLevon[playerid] = SetTimer(\"EhesTimer\", 1000000, true);SzomjLevon[playerid] = SetTimer(\"SzomjTimer\", 1000000, true);return 1;}public OnPlayerDeath(playerid, killerid, reason){ KillTimer(EhsegLevon[playerid]); KillTimer(SzomjLevon[playerid]);return 1;}public EhesTimer(){for(new player; player < MAX_PLAYERS; player++){ jAdat[player][jEhes] --;}return 1;}public SzomjTimer(){for(new player; player < MAX_PLAYERS; player++){ jAdat[player][jSzomjas] --;}return 1;}public EhsegText(playerid){ for(new player; player < MAX_PLAYERS; player++){ if( IsPlayerConnected(player)) { if(jAdat[player][jEhes] <= 10) { SendClientMessage(player, 0x76EEC6FF, \"Egyél valamit!\"); } if(jAdat[player][jEhes] <= 3) { SetPlayerHealth(player, 3); cmd_me(player, \"rosszul lett\"); TogglePlayerControllable(player, false); SendClientMessage(player, 0x76EEC6FF, \"Összenyaklottál \"); switch( random( 2 ) ) { case 0: ApplyAnimation(player,\"SWEET\",\"Sweet_injuredloop\", 4.0, 1, 0, 0, 0, 0); case 1: ApplyAnimation(player, \"CRACK\", \"crckdeth2\", 4.0, 1, 0, 0, 0, 0); } } }}return 1;}public SzomjusagText(playerid){ for(new player; player < MAX_PLAYERS; player++){ if( IsPlayerConnected(player)) { if(jAdat[player][jSzomjas] <= 10) { SendClientMessage(player, 0x76EEC6FF, \"Igyál valamit!\"); } if(jAdat[player][jSzomjas] <= 3) { SetPlayerHealth(player, 3); cmd_me(player, \"rosszul lett\"); TogglePlayerControllable(player, false); SendClientMessage(player, 0x76EEC6FF, \"Összenyaklottál \"); switch( random( 2 ) ) { case 0: ApplyAnimation(player,\"SWEET\",\"Sweet_injuredloop\", 4.0, 1, 0, 0, 0, 0); case 1: ApplyAnimation(player, \"CRACK\", \"crckdeth2\", 4.0, 1, 0, 0, 0, 0); } } }}return 1;}public OnVehicleSpawn(vehicleid){return 1;}public OnVehicleDeath(vehicleid, killerid){return 1;}public OnPlayerText(playerid, text[]){return 1;}public OnPlayerCommandText(playerid, cmdtext[]){if (strcmp(\"/mycommand\", cmdtext, true, 10) == 0){ // Do something here return 1;}return 0;}public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){return 1;}public OnPlayerExitVehicle(playerid, vehicleid){return 1;}public OnPlayerStateChange(playerid, newstate, oldstate){return 1;}public OnPlayerEnterCheckpoint(playerid){return 1;}public OnPlayerLeaveCheckpoint(playerid){return 1;}public OnPlayerEnterRaceCheckpoint(playerid){return 1;}public OnPlayerLeaveRaceCheckpoint(playerid){return 1;}public OnRconCommand(cmd[]){return 1;}public OnPlayerRequestSpawn(playerid){return 1;}public OnObjectMoved(objectid){return 1;}public OnPlayerObjectMoved(playerid, objectid){return 1;}public OnPlayerPickUpPickup(playerid, pickupid){return 1;}public OnVehicleMod(playerid, vehicleid, componentid){return 1;}public OnVehiclePaintjob(playerid, vehicleid, paintjobid){return 1;}public OnVehicleRespray(playerid, vehicleid, color1, color2){return 1;}public OnPlayerSelectedMenuRow(playerid, row){return 1;}public OnPlayerExitedMenu(playerid){return 1;}public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid){return 1;}public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){ if(PRESSED(KEY_JUMP)) { if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { if(jAdat[playerid][jEhes] <= 5 || jAdat[playerid][jSzomjas] <= 5) { SendClientMessage(playerid, 0x76EEC6FF, \"Nincs elég energiád az ugráshoz!\"); new Float:nx, Float:ny, Float:nz; GetPlayerPos(playerid, nx, ny, nz); SetPlayerPos(playerid, nx, ny, nz); //Nem engedi ugrani } else { //Ha, van energiája levonja jAdat[playerid][jEhes] -= 1; jAdat[playerid][jSzomjas] -= 1; } }}return 1;}public OnRconLoginAttempt(ip[], password[], success){return 1;}public OnPlayerUpdate(playerid){return 1;}public OnPlayerStreamIn(playerid, forplayerid){return 1;}public OnPlayerStreamOut(playerid, forplayerid){return 1;}public OnVehicleStreamIn(vehicleid, forplayerid){return 1;}public OnVehicleStreamOut(vehicleid, forplayerid){return 1;}public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){return 1;}public OnPlayerClickPlayer(playerid, clickedplayerid, source){return 1;}
for(new player; player < MAX_PLAYERS; player++)
csak egy alap \"fél\"script... Alkalmazva van másképp, ha gondolod holnap megnézheted:D Nem beszélek félre, csak szimplán nem bírom magam kifejezni.
forward EhsegText();forward SzomjusagText();public OnPlayerConnect(playerid){ EhsegText();SzomjusagText();return 1;}public EhsegText(){ for(new player; player < MAX_PLAYERS; player++){ if( IsPlayerConnected(player)) { if(jAdat[player][jEhes] <= 10) { SendClientMessage(player, 0x76EEC6FF, \"Egyél valamit!\"); } if(jAdat[player][jEhes] <= 3) { SetPlayerHealth(player, 3); cmd_me(player, \"rosszul lett\"); TogglePlayerControllable(player, false); SendClientMessage(player, 0x76EEC6FF, \"Összenyaklottál \"); switch( random( 2 ) ) { case 0: ApplyAnimation(player,\"SWEET\",\"Sweet_injuredloop\", 4.0, 1, 0, 0, 0, 0); case 1: ApplyAnimation(player, \"CRACK\", \"crckdeth2\", 4.0, 1, 0, 0, 0, 0); } } }}return 1;}public SzomjusagText(){ for(new player; player < MAX_PLAYERS; player++){ if( IsPlayerConnected(player)) { if(jAdat[player][jSzomjas] <= 10) { SendClientMessage(player, 0x76EEC6FF, \"Igyál valamit!\"); } if(jAdat[player][jSzomjas] <= 3) { SetPlayerHealth(player, 3); cmd_me(player, \"rosszul lett\"); TogglePlayerControllable(player, false); SendClientMessage(player, 0x76EEC6FF, \"Összenyaklottál \"); switch( random( 2 ) ) { case 0: ApplyAnimation(player,\"SWEET\",\"Sweet_injuredloop\", 4.0, 1, 0, 0, 0, 0); case 1: ApplyAnimation(player, \"CRACK\", \"crckdeth2\", 4.0, 1, 0, 0, 0, 0); } } }}return 1;}