Sziasztok. Elhoztam nektek egy saját készítésű munka rendszert, amit RP szervereken, szerintem nagyon jól lehet alkalmazni. Ezt én csináltam.
Parancsok:
-/rendor
-/mentos
-/testor
-/kilepmunka
-/szerelo
-/parancsok
A /parancsok, azokat a parancsokat mutatja meg, ami a munkádhoz kötődik. pl.: Rendőrnek /borton /sokkol /unborton. Ez egy kód lenne:
#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 Tokyoo 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 Tokyoo\");
SendClientMessage(playerid, COLOR_GREY, \"Írd be /munka 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! (/kilepmunka)\");
}
return 1;
}
if(strcmp(cmd, \"/rendor\", 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! (/kilepmunka)\");
}
return 1;
}
if(strcmp(cmd, \"/szerelo\", 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! (/kilepmunka)\");
}
return 1;
}
if(strcmp(cmd, \"/mentos\", 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! (/kilepmunka)\");
}
return 1;
}
if(strcmp(cmd, \"/testor\", 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! (/kilepmunka)\");
}
return 1;
}
//Egyéb parancsok
if(strcmp(cmd, \"/kilepmunka\", 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, \"/munka\", true) == 0)
{
SendClientMessage(playerid, COLOR_RED, \"MUNKÁK:\");
SendClientMessage(playerid, COLOR_YELLOW, \"/taxi - Taxis\");
SendClientMessage(playerid, COLOR_YELLOW, \"/rendor - Rendőr\");
SendClientMessage(playerid, COLOR_YELLOW, \"/szerelo - Autószerelő\");
SendClientMessage(playerid, COLOR_YELLOW, \"/mentos - Mentős\");
SendClientMessage(playerid, COLOR_YELLOW, \"/testor - Testőr\");
SendClientMessage(playerid, COLOR_YELLOW, \"/kilepmunka - kilép a munkából\");
SendClientMessage(playerid, COLOR_YELLOW, \"/parancsok - munka parancsok\");
return 1;
}
if(strcmp(cmd, \"/parancsok\", 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>, /borton <ID>, /unborton <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, \"/elet <ID>\");
}
else if(gTeam[playerid] == TEAM_AMBULANCE)
{
SendClientMessage(playerid, COLOR_YELLOW, \"Testőr parancsok:\");
SendClientMessage(playerid, COLOR_YELLOW, \"/testor <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, \"/borton\", true) == 0)
{
if(gTeam[playerid] == TEAM_POLICE)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, \"[HASZNÁLAT]: /borton <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, \"/unbonron\", true) == 0)
{
if(gTeam[playerid] == TEAM_POLICE)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, \"[HASZNÁLAT]: /unborton <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, \"/elet\", true) == 0)
{
if(gTeam[playerid] == TEAM_AMBULANCE)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, \"[HASZNÁLAT]: /elet <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, \"/testor\", true) == 0)
{
if(gTeam[playerid] == TEAM_AMBULANCE)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_RED, \"[HASZNÁLAT]: /testor <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 3400$-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 /mentos 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;
}
:thumbsup: :thumbsup: :thumbsup: :thumbsup: