Üdv, emberek!
Nem rég elõvettem a régi gépemet, és megtaláltam egy-két filterscriptemet!
Ezek anno publikálva lettek, de már nem találhatóak meg!
Így itt megosztanám a \"jobs\" nevû filterscriptemet!
//------------------------------------------------------------------------------
// File: jobs.pwn (version: 2.0)
//
// Desc: Munkalehetõségek módokhoz
//
// Update: 2009/01/01 (verzió: 1.0)
// - Elsõ verzió megjelenése
//
// 2009/01/03 (verzió: 2.0)
// - Autószerelõ hiba javítva
// - /quitjob parancsal történõ hibák javítva
// - parancsok hibái javítva
//
// 2009/03/26 (verzió: 2.0)
// - fagyás javítva
//
// Author: Spatrik
//
// Minden jog fenntartva, Copyright (c) 2009 [_PGB_]Spatrik
//------------------------------------------------------------------------------
#include <a_samp>
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define FILTERSCRIPT
#if defined FILTERSCRIPT
#define TEAM_CIVILIAN 1
#define TEAM_TAXI 2
#define TEAM_POLICE 3
#define TEAM_SERVISE 4
#define TEAM_AMBULANCE 5
#define TEAM_GUARD 6
forward Money();
new gTeam[MAX_PLAYERS];
new name[MAX_PLAYER_NAME];
new money;
public OnFilterScriptInit()
{
print(\" Job system by [GH_Spatrik] betoltve!\");
money = SetTimer(\"Money\", 300000, true);
return 1;
}
public OnFilterScriptExit()
{
KillTimer(money);
return 1;
}
#endif
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, COLOR_GREY, \"Job System betöltve by [_PGB_]Spatrik\");
SendClientMessage(playerid, COLOR_GREY, \"Írd be /jobs a munkákért!\");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new tmp[256];
new cmd[256];
new string[256];
new giveplayerid, idx;
cmd = strtok(cmdtext, idx);
tmp = strtok(cmdtext, idx);
giveplayerid = strval(tmp);
//Munkák--------------------------------------------------------------------
if(strcmp(cmd, \"/taxi\", true) == 0)
{
if(gTeam[playerid] == TEAM_CIVILIAN)
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"Taxis, %s szolgálatban!\", name);
SendClientMessageToAll(COLOR_GREEN, string);
gTeam[playerid] = TEAM_TAXI;
} else {
SendClientMessage(playerid, COLOR_RED, \"Elõször lépj ki a mostani munkádból! (/quitjob)\");
}
return 1;
}
if(strcmp(cmd, \"/police\", true) == 0)
{
if(gTeam[playerid] == TEAM_CIVILIAN)
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"Rendõr, %s szolgálatban!\", name);
SendClientMessageToAll(COLOR_GREEN, string);
SetPlayerArmour(playerid, 100);
gTeam[playerid] = TEAM_POLICE;
} else {
SendClientMessage(playerid, COLOR_RED, \"Elõször lépj ki a mostani munkádból! (/quitjob)\");
}
return 1;
}
if(strcmp(cmd, \"/carservice\", true) == 0)
{
if(gTeam[playerid] == TEAM_CIVILIAN)
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"Autószerelõ, %s szolgálatban!\", name);
SendClientMessageToAll(COLOR_GREEN, string);
gTeam[playerid] = TEAM_SERVISE;
} else {
SendClientMessage(playerid, COLOR_RED, \"Elõször lépj ki a mostani munkádból! (/quitjob)\");
}
return 1;
}
if(strcmp(cmd, \"/ambulance\", true) == 0)
{
if(gTeam[playerid] == TEAM_CIVILIAN)
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"Mentõs, %s szolgálatban!\", name);
SendClientMessageToAll(COLOR_GREEN, string);
SetPlayerHealth(playerid, 100);
gTeam[playerid] = TEAM_AMBULANCE;
} else {
SendClientMessage(playerid, COLOR_RED, \"Elõször lépj ki a mostani munkádból! (/quitjob)\");
}
return 1;
}
if(strcmp(cmd, \"/guard\", true) == 0)
{
if(gTeam[playerid] == TEAM_CIVILIAN)
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"Testõr, %s szolgálatban!\", name);
SendClientMessageToAll(COLOR_GREEN, string);
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
gTeam[playerid] = TEAM_GUARD;
} else {
SendClientMessage(playerid, COLOR_RED, \"Elõször lépj ki a mostani munkádból! (/quitjob)\");
}
return 1;
}
//Egyéb parancsok
if(strcmp(cmd, \"/quitjob\", true) == 0)
{
if(gTeam[playerid] == TEAM_TAXI || gTeam[playerid] == TEAM_POLICE || gTeam[playerid] == TEAM_SERVISE || gTeam[playerid] == TEAM_AMBULANCE || gTeam[playerid] == TEAM_GUARD)
{
gTeam[playerid] = TEAM_CIVILIAN;
} else {
SendClientMessage(playerid, COLOR_RED, \"Most sincs munkád!\");
}
return 1;
}
if(strcmp(cmd, \"/jobs\", true) == 0)
{
SendClientMessage(playerid, COLOR_RED, \"MUNKÁK:\");
SendClientMessage(playerid, COLOR_YELLOW, \"/taxi - Taxis\");
SendClientMessage(playerid, COLOR_YELLOW, \"/police - Rendõr\");
SendClientMessage(playerid, COLOR_YELLOW, \"/carservice - Autószerelõ\");
SendClientMessage(playerid, COLOR_YELLOW, \"/ambulance - Mentõs\");
SendClientMessage(playerid, COLOR_YELLOW, \"/guard - Testõr\");
SendClientMessage(playerid, COLOR_YELLOW, \"/quitjob - kilép a munkából\");
SendClientMessage(playerid, COLOR_YELLOW, \"/job-cmds - munka parancsok\");
return 1;
}
if(strcmp(cmd, \"/job-cmds\", true) == 0)
{
SendClientMessage(playerid, COLOR_RED, \"PARANCSOK:\");
if(gTeam[playerid] == TEAM_POLICE)
{
SendClientMessage(playerid, COLOR_YELLOW, \"Rendõr parancsok:\");
SendClientMessage(playerid, COLOR_YELLOW, \"/sokkol <ID>, /jail <ID>, /unjail <ID>\");
}
else if(gTeam[playerid] == TEAM_SERVISE)
{
SendClientMessage(playerid, COLOR_YELLOW, \"Autószerelõ parancsok:\");
SendClientMessage(playerid, COLOR_YELLOW, \"/javitas <ID>\");
}
else if(gTeam[playerid] == TEAM_AMBULANCE)
{
SendClientMessage(playerid, COLOR_YELLOW, \"Mentõs parancsok:\");
SendClientMessage(playerid, COLOR_YELLOW, \"/heal <ID>\");
}
else if(gTeam[playerid] == TEAM_AMBULANCE)
{
SendClientMessage(playerid, COLOR_YELLOW, \"Testõr parancsok:\");
SendClientMessage(playerid, COLOR_YELLOW, \"/guard <ID>\");
}
else if(gTeam[playerid] == TEAM_CIVILIAN)
{
SendClientMessage(playerid, COLOR_YELLOW, \"Nincs munkád!\");
}
return 1;
}
//Rendõrségi parancsok------------------------------------------------------
new jailed[MAX_PLAYERS];
if(strcmp(cmd, \"/sokkol\", true) == 0)
{
if(gTeam[playerid] == TEAM_POLICE)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, \"[HASZNÁLAT]: /sokkol <ID>\");
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED, \"Nem sokkolhatod meg magad, vagy hibás az ID!\");
} else {
if(IsPlayerConnected(giveplayerid))
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"%s megsokkolt a sokkolójával!\", name);
SendClientMessage(giveplayerid, COLOR_RED, string);
new Float:Health;
SetPlayerHealth(playerid, GetPlayerHealth(playerid, Health) -50);
SendClientMessage(playerid, COLOR_GREEN, \"Sikeres sokkolás!\");
} else {
SendClientMessage(playerid, COLOR_RED, \"Nincs ilyen játékos!\");
}
}
} else {
SendClientMessage(playerid,COLOR_RED,\"Nem vagy rendõr!\");
}
return 1;
}
if(strcmp(cmd, \"/jail\", true) == 0)
{
if(gTeam[playerid] == TEAM_POLICE)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, \"[HASZNÁLAT]: /jail <ID>\");
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED, \"Nem zárhatod be magad, vagy hibás az ID!\");
} else {
if(IsPlayerConnected(giveplayerid))
{
if (jailed[giveplayerid] == 0)
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"%s lecsukott!\", name);
SendClientMessage(giveplayerid, COLOR_RED, string);
new string2[256];
new name2[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, name2, sizeof (name2));
format(string2, sizeof(string2), \"%s lecsukta %s-t!\", name, name2);
SendClientMessageToAll(COLOR_RED, string2);
SetPlayerInterior(giveplayerid, 6);
SetPlayerPos(giveplayerid, 264.3591,77.5832,1001.0391);
SetCameraBehindPlayer(giveplayerid);
ResetPlayerWeapons(giveplayerid);
ResetPlayerMoney(giveplayerid);
jailed[giveplayerid] = 1;
SendClientMessage(playerid, COLOR_GREEN, \"Sikeres lecsukás!\");
} else {
SendClientMessage(playerid, COLOR_RED, \"Ez a játékos már le van csukva!\");
}
} else {
SendClientMessage(playerid, COLOR_RED, \"Nincs ilyen játékos!\");
}
}
} else {
SendClientMessage(playerid,COLOR_RED,\"Nem vagy rendõr!\");
}
return 1;
}
if(strcmp(cmd, \"/unjail\", true) == 0)
{
if(gTeam[playerid] == TEAM_POLICE)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, \"[HASZNÁLAT]: /unjail <ID>\");
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED, \"Nem engedheted ki magad, vagy hibás az ID!\");
} else {
if(IsPlayerConnected(giveplayerid))
{
if (jailed[giveplayerid] == 1)
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"%s kiengedett!\", name);
SendClientMessage(giveplayerid, COLOR_RED, string);
new string2[256];
new name2[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, name2, sizeof (name2));
format(string2, sizeof(string2), \"%s kiengedte %s-t!\", name, name2);
SendClientMessageToAll(COLOR_RED, string2);
SetPlayerInterior(giveplayerid, 0);
SetPlayerPos(giveplayerid,1546.1195,-1675.4786,13.5617);
SetCameraBehindPlayer(giveplayerid);
ResetPlayerWeapons(giveplayerid);
jailed[giveplayerid] = 0;
SendClientMessage(playerid, COLOR_GREEN, \"Sikeres kiengedés!\");
} else {
SendClientMessage(playerid, COLOR_RED, \"Ez a játékos már ki van engedve!\");
}
} else {
SendClientMessage(playerid, COLOR_RED, \"Nincs ilyen játékos!\");
}
}
} else {
SendClientMessage(playerid,COLOR_RED,\"Nem vagy rendõr!\");
}
return 1;
}
//Autószerelõ parancsok
new vehicleid = GetPlayerVehicleID(giveplayerid);
if(strcmp(cmd, \"/javitas\", true) == 0)
{
if(gTeam[playerid] == TEAM_SERVISE)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, \"[HASZNÁLAT]: /javitas <ID>\");
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED, \"Nem javíthatod meg a saját kocsidat, vagy hibás az ID!\");
} else {
if(IsPlayerConnected(giveplayerid))
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"%s megjavította a kocsidat!\", name);
SendClientMessage(giveplayerid, COLOR_RED, string);
SetVehicleHealth(vehicleid, 1000);
GivePlayerMoney(giveplayerid, -50);
GivePlayerMoney(playerid, 50);
SendClientMessage(playerid, COLOR_GREEN, \"Sikeres javítás!\");
} else {
SendClientMessage(playerid, COLOR_RED, \"Nincs ilyen játékos!\");
}
}
} else {
SendClientMessage(playerid,COLOR_RED,\"Nem vagy autószerelõ!\");
}
return 1;
}
//Mentõs parancsok
if(strcmp(cmd, \"/heal\", true) == 0)
{
if(gTeam[playerid] == TEAM_AMBULANCE)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, \"[HASZNÁLAT]: /heal <ID>\");
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED, \"Nem gyógyíthatod meg magad, vagy hibás az ID!\");
} else {
if(IsPlayerConnected(giveplayerid))
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"%s megmentette az életedet!\", name);
SendClientMessage(giveplayerid, COLOR_RED, string);
SetPlayerHealth(giveplayerid, 100);
GivePlayerMoney(giveplayerid, -100);
GivePlayerMoney(playerid, 100);
SendClientMessage(playerid, COLOR_GREEN, \"Sikeres mentés!\");
} else {
SendClientMessage(playerid, COLOR_RED, \"Nincs ilyen játékos!\");
}
}
} else {
SendClientMessage(playerid,COLOR_RED,\"Nem vagy mentõs!\");
}
return 1;
}
//Testõr parancsok
if(strcmp(cmd, \"/guard\", true) == 0)
{
if(gTeam[playerid] == TEAM_AMBULANCE)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, \"[HASZNÁLAT]: /guard <ID>\");
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED, \"Nem védheted meg magad, vagy hibás az ID!\");
} else {
if(IsPlayerConnected(giveplayerid))
{
GetPlayerName(playerid, name, sizeof (name));
format(string, sizeof(string), \"%s az életedre fog vigyázni!\", name);
SendClientMessage(giveplayerid, COLOR_RED, string);
GivePlayerMoney(giveplayerid, -1000);
GivePlayerMoney(playerid, 1000);
GivePlayerWeapon(playerid, 4, 1);
GivePlayerWeapon(playerid, 23, 1000);
GivePlayerWeapon(playerid, 31, 10000);
SendClientMessage(playerid, COLOR_GREEN, \"Elvállaltad a melót!\");
} else {
SendClientMessage(playerid, COLOR_RED, \"Nincs ilyen játékos!\");
}
}
} else {
SendClientMessage(playerid,COLOR_RED,\"Nem vagy testõr!\");
}
return 1;
}
return 0;
}
public OnPlayerRequestClass(playerid, classid)
{
if(classid == 0 || classid == 1)
{
gTeam[playerid] = TEAM_CIVILIAN;
}
}
public Money()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(gTeam == TEAM_TAXI || gTeam == TEAM_POLICE || gTeam == TEAM_SERVISE || TEAM_AMBULANCE || TEAM_GUARD)
{
GivePlayerMoney(i, 150);
SendClientMessage(i, COLOR_WHITE, \"[FIZETÉS]: Kaptál 150$-t!\");
}
}
}
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
//Police cars
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 599 || GetVehicleModel(vehicleid) == 598 || GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 596)
{
if(gTeam[playerid] == TEAM_POLICE)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, \"Ez a jármû a rendõröké!. Írd be a rendõrös munkához, hogy /police vagy nem vezetheted a jármûvet!\");
}
}
//Taxi
if(GetVehicleModel(vehicleid) == 420)
{
if(gTeam[playerid] == TEAM_TAXI)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, \"Ez a jármû a taxisoké!. Írd be a taxis munkához, hogy /taxi vagy nem vezetheted a jármûvet!\");
}
}
//Mentõs
if(GetVehicleModel(vehicleid) == 416)
{
if(gTeam[playerid] == TEAM_AMBULANCE)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_RED, \"Ez a jármû a mentõsöké!. Írd be a mentõs munkához, hogy /ambulance vagy nem vezetheted a jármûvet!\");
}
}
}
return 1;
}
public OnPlayerDeath(playerid)
{
gTeam[playerid] = TEAM_CIVILIAN;
SendClientMessage(playerid, COLOR_RED, \"Meghaltál azaz kiléptél a munkádból! \");
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= \' \'))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > \' \') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Mûködése egyszerû, egy két parancs van!
/police(/jail, unjaul, sokkol)
/taxi
/ambulance (/heal)
/guard (/guard)
/carservice (/javitas)
Gondolom nem kell õket részleteznem