#include a_samp
#include dudb
#include dini
#include sscanf
#define SERVER_USER_FILE "%s.ini"
new bool:pos;
#pragma dynamic 500000
#pragma tabsize 0
#define dcmd(%1,%2,%3) if((strcmp((%3)[1],#%1,true,(%2))==0)&&((((%3)[(%2)+1]==0)&&(dcmd_%1(playerid,"")))||(((%3)[(%2)+1]==32)&&(dcmd_%1(playerid,(%3)[(%2)+2]))))) return 1
new BodyVsech[MAX_PLAYERS];
//Piloti
new PracePLV[MAX_PLAYERS];
//Prace
/*==============LV================*/
new Praces[MAX_PLAYERS];
new Praces2[MAX_PLAYERS];
new PilotLVMise[MAX_PLAYERS];
new Proces[MAX_PLAYERS];
new PracovniMise[MAX_PLAYERS];
new PracovniMise2[MAX_PLAYERS];
/*===============Ls===============*/
new PracesLS[MAX_PLAYERS];
new PracesLS2[MAX_PLAYERS];
new LSMISE[MAX_PLAYERS];
new ProcesLS[MAX_PLAYERS];
new PracovniMiseLS[MAX_PLAYERS];
new PracovniMise2LS[MAX_PLAYERS];
/*====================sf==================*/
new PracesSF[MAX_PLAYERS];
new PracesSF2[MAX_PLAYERS];
new SFMise[MAX_PLAYERS];
new ProcesSF[MAX_PLAYERS];
new PracovniMiseSF[MAX_PLAYERS];
new PracovniMise2SF[MAX_PLAYERS];
enum pInfo
{
Nahrany_Cas,
}
// místa LS
new Float:PilotLS[][4] =
{
{1756.9097,-2436.8936,13.1623},
{1901.2092,-2340.0247,13.1448},
{1896.3304,-2260.7263,13.1522},
{1810.0992,-2429.8157,13.1624}
};
//místa SF
new Float:PilotSF[][4] =
{
{-1369.0988,-156.4794,13.7562}, //
{-1381.6356,-194.7723,13.7539},
{-1376.1306,-226.6201,13.7559},
{-1349.6462,-264.2870,13.7561}
};
// místa LV
new Float:PilotLV[][4] =
{
{1575.6315,1493.8434,10.8291}, //
{1568.3660,1531.6614,10.8341},
{1575.5748,1403.4070,10.8398},
{1572.1003,1365.1322,10.8653}
};
// LS + SF
new Float:xx[2][3] =
{
{1957.9993,-2492.1423,13.1468}, //
{-1289.2502,203.9598,13.7563}
};
// LV + SF
new Float:xxLS[2][3] =
{
{1387.1040,1639.7454,10.8125}, //
{-1289.2502,203.9598,13.7563}
};
// LV + LS
new Float:xxSF[2][3] =
{
{1387.1040,1639.7454,10.8125}, //
{1957.9993,-2492.1423,13.1468}
};
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
public OnGameModeInit()
{
UsePlayerPedAnims ();
SetGameModeText("Pilot's Life");
AddPlayerClass(0,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
CreateVehicle(519, 1304.1658, 1360.3474, 11.7814, 275.0000, -1, -1, 1000);
CreateVehicle(519, 1304.7345, 1322.6960, 11.7814, 275.0000, -1, -1, 1000);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(pracovat,8,cmdtext);
dcmd(commands,8,cmdtext);
return 1;
}
dcmd_commands(playerid, params[])
{
#pragma unused params
SendClientMessage(playerid,0xDFDFDDD," {FFFFFF}[ {FF0000}Server {FFFFFF}] {FFFFFF} Dorobit to");
return 1;
}
dcmd_pracovat(playerid, params[])
{
#pragma unused params
if(PracePLV[playerid] == 1)
{
if(PracovniMise[playerid] == 1 || PracovniMise2[playerid] == 1) return SendClientMessage(playerid,-1,"Už děláš misi!");
if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 519 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 553 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 577 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 592 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 593 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 511) return SendClientMessage(playerid,-1,"Nejsi ve správném autě");
if(IsPlayerInArea(playerid, 1226.177,1152.217,1740.004,1880.139))
{
new randLV = random(sizeof(PilotLV));
PilotLVMise[playerid] = SetPlayerCheckpoint(playerid, PilotLV[randLV][0], PilotLV[randLV][1],PilotLV[randLV][2],4.0);
Praces[playerid] = 1;
PracovniMise[playerid] = 1;
}
else if(IsPlayerInArea(playerid, -1747.789,-731.814,-945.908,482.686))
{
new randSF = random(sizeof(PilotSF));
SFMise[playerid] = SetPlayerCheckpoint(playerid, PilotSF[randSF][0], PilotSF[randSF][1],PilotSF[randSF][2],4.0);
PracesSF[playerid] = 1;
PracovniMiseSF[playerid] = 1;
}
else if(IsPlayerInArea(playerid, 1296.245,-2736.516,2187.656,-2140.945))
{
new randLS = random(sizeof(PilotLS));
LSMISE[playerid] = SetPlayerCheckpoint(playerid, PilotLS[randLS][0], PilotLS[randLS][1],PilotLS[randLS][2],4.0);
PracesLS[playerid] = 1;
PracovniMiseLS[playerid] = 1;
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
pos = false;
new file[64];
format(file, sizeof file, "%s.ini", Jmeno(playerid));
if (!dini_Exists(file))
{
new string[600];
new str[64], IPplayer[16];
strcat(string,"{FF0000}Vítejte na serveru s módem {00FFFF}Pilot's Life\n");
strcat(string,"\n");
strcat(string,"{FFFFFF}Tento {00FFFF}Nick {FFFFFF}ještě neexistuje.\n");
strcat(string,"{FF0000}REGISTRACE je POVINNÁ!\n");
strcat(string,"\n");
format(str, sizeof str, "{FFFFFF}Nick: {00FFFF}%s \n", Jmeno(playerid));
strcat(string, str);
GetPlayerIp(playerid, IPplayer, 16);
format(str, sizeof str, "{FFFFFF}IP: {00FFFF}%s \n", IPplayer);
strcat(string, str);
ShowPlayerDialog(playerid, 81, DIALOG_STYLE_PASSWORD, "Registrace", string, "Registrovat", "Odpojit");
}
if(fexist(file))
{
new string[700];
new str[64], IPplayer[16];
strcat(string,"{FFFFFF}Vítejte zpět na serveru s módem {00FFFF}Pilot's Life\n");
strcat(string,"\n");
strcat(string,"{FFFFFF}Tento {00FFFF}Nick {FFFFFF}už existuje.\n");
strcat(string,"Zadejte heslo:\n");
strcat(string,"\n");
format(str, sizeof str, "{FFFFFF}Nick: {00FFFF}%s \n", Jmeno(playerid));
strcat(string, str);
GetPlayerIp(playerid, IPplayer, 16);
format(str, sizeof str, "{FFFFFF}IP: {00FFFF}%s \n", IPplayer);
strcat(string, str);
ShowPlayerDialog(playerid, 82, DIALOG_STYLE_PASSWORD, "Přihlášení", string, "Přihlásit", "Odpojit");
}
new string[250];
format(string,sizeof string,"{778899}[ {7CFC00}Connect {778899}] Hráč {7CFC00}%s {778899}(ID: {7CFC00}%d{778899}) přišel na server",Jmeno(playerid),playerid);
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
pos = false;
new file[256];
format(file, sizeof(file), SERVER_USER_FILE, Jmeno(playerid));
if(gPlayerLogged[playerid] == 1)
{
SavePos(playerid, file);
dini_IntSet( file , "Nahrany_Cas" , PlayerInfo[ playerid ][ Nahrany_Cas ] + (NetStats_GetConnectedTime(playerid)/1000));
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(Praces[playerid] == 1)
{
PilotLVMise[playerid] = DisablePlayerCheckpoint(playerid);
SetTimerEx("CestujiciToNaklada", 5000, false, "i", playerid);
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,-1,"Nákladám cestujicí");
Praces[playerid] = 0;
PracovniMise2[playerid] = 1;
}
else if(Praces2[playerid] == 1)
{
Proces[playerid] = DisablePlayerCheckpoint(playerid);
GivePlayerMoney(playerid, 36784);
BodyVsech[playerid] ++;
SendClientMessage(playerid,-1,"Dostal jsi 36784 $");
PracovniMise[playerid] = 0;
PracovniMise2[playerid] = 0;
}
if(ProcesLS[playerid] == 1)
{
LSMISE[playerid] = DisablePlayerCheckpoint(playerid);
SetTimerEx("CestujiciToNakladaLS", 5000, false, "i", playerid);
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,-1,"Nákladám cestujicí");
ProcesLS[playerid] = 0;
PracovniMise2LS[playerid] = 1;
}
else if(PracesLS2[playerid] == 1)
{
ProcesLS[playerid] = DisablePlayerCheckpoint(playerid);
GivePlayerMoney(playerid, 34987);
BodyVsech[playerid] ++;
SendClientMessage(playerid,-1,"Dostal jsi 36784 $");
PracovniMiseLS[playerid] = 0;
PracovniMise2LS[playerid] = 0;
}
if(ProcesSF[playerid] == 1)
{
SFMise[playerid] = DisablePlayerCheckpoint(playerid);
SetTimerEx("CestujiciToNakladaSF", 5000, false, "i", playerid);
TogglePlayerControllable(playerid,0);
SendClientMessage(playerid,-1,"Nákladám cestujicí");
PracovniMise2SF[playerid] = 1;
ProcesSF[playerid] = 0;
}
else if(PracesSF2[playerid] == 1)
{
ProcesSF[playerid] = DisablePlayerCheckpoint(playerid);
GivePlayerMoney(playerid, 37531);
BodyVsech[playerid] ++;
SendClientMessage(playerid,-1,"Dostal jsi 36784 $");
PracovniMiseSF[playerid] = 0;
PracovniMise2SF[playerid] = 0;
}
return 1;
}
public OnPlayerSpawn(playerid)
{
new file[104];
format(file, sizeof(file), SERVER_USER_FILE, Jmeno(playerid));
SetPlayerInterior(playerid,0);
if(pos == false)
{
LoadPos(playerid, file);
}
else SetPlayerPos(playerid, 1606.8881,1822.6760,10.8203);// nemocnine? trba když zemře tam ho to spawne? zkus ještě tam dám nemocnici jako souřadnice
new promena = dini_Int(file, "prvni navsteva");
if(promena == 0)
{
SetPlayerColor(playerid,-1);
GivePlayerMoney(playerid,5000);
new string[3000];
strcat(string,"{00ff00}Pilot 0\n");
strcat(string,"{00ff00}Kamionista 0\n");
strcat(string,"{ff0000}Řidič limuzíny 150\n");
strcat(string,"{ff0000}Řidič taxíku 200\n");
strcat(string,"{ff0000}Řidič Policie 250\n");
strcat(string,"{ff0000}Sanitář Řidič 300\n");
ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"{FFD700}Povolaní Menu Body k povolaní",string,"Hrát","");
dini_IntSet(file, "prvni navsteva", 1);//a mas to
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 81)
{
new file[64], string[128];
new IPplayer[64];
format(file, sizeof(file), SERVER_USER_FILE, Jmeno(playerid));
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 81, DIALOG_STYLE_PASSWORD, "Registrace", "Prosím Registruj se", "Registrovat", "Odpojit");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
GetPlayerIp(playerid, IPplayer, 16);
format(string,128, "{FF0000}[ {FFFFFF} Server {FF0000}] {FFFFFF} Nick : %s | Heslo : %s | IP : %s", Jmeno(playerid), inputtext, IPplayer);
SendClientMessage(playerid, -1, string);
format(string,128, "{FF0000}[{FFFFFF} Server {FF0000}] {FFFFFF} Úspěšně si se zaregistroval", Jmeno(playerid), inputtext);
SendClientMessage(playerid, -1, string);
gPlayerLogged[playerid] = 1;
}
if (dialogid == 82)
{
new file[64];
format(file, sizeof(file), SERVER_USER_FILE, Jmeno(playerid));
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 81, DIALOG_STYLE_PASSWORD, "Jsi zaregistrovaný", "Pamatuj si Heslo", "Prihlasit se", "Odpojit");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp)
{
new string[500];
new str[64], IPplayer[16];
strcat(string,"{FFFFFF}Vítejte zpětna serveru s módem {00FFFF}Pilot's Life\n");
strcat(string,"\n");
strcat(string,"{FFFFFF}Tento {00FFFF}Nick {FFFFFF}už existuje.\n");
strcat(string,"Zadejte heslo:\n");
strcat(string,"\n");
strcat(string,"\n");
format(str, sizeof str, "{FFFFFF}Nick: {00FFFF}%s \n", Jmeno(playerid));
strcat(string, str);
GetPlayerIp(playerid, IPplayer, 16);
format(str, sizeof str, "{FFFFFF}IP: {00FFFF}%s \n", IPplayer);
strcat(string, str);
ShowPlayerDialog(playerid, 82, DIALOG_STYLE_PASSWORD, "Přihlašení",string, "Přihlásit se", "Odpojit");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[ playerid ][ Nahrany_Cas ] = dini_Int( file , "Nahrany_Cas" );
SendClientMessage(playerid,-1, "{FF0000}[ {FFFFFF}Server {FF0000}] {FFFFFF} Úspešně přihlášení/á");
}
}
if(dialogid == 3)
{
if(response)
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"Výběr spawnu","Las Venturas Aiport\nLos Santos Aiport\nSan Fierro Aiport","Vybrat","Zavřít");
}
case 1:
{
SendClientMessage(playerid,0xFF000000,"Nemáte 100 Score");
new string[3000];
strcat(string,"{00ff00}Pilot 0\n");
strcat(string,"{00ff00}Kamionista 0\n");
strcat(string,"{ff0000}Řidič limuzíny 150\n");
strcat(string,"{ff0000}Řidič taxíku 200\n");
strcat(string,"{ff0000}Řidič Policie 250\n");
strcat(string,"{ff0000}Sanitář Řidič 300\n");
ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"{FFD700}Povolaní Menu Body k povolaní",string,"Hrát","");
}
case 2:
{
SendClientMessage(playerid,0xFF000000,"Nemáte 150 Score");
new string[3000];
strcat(string,"{00ff00}Pilot 0\n");
strcat(string,"{00ff00}Kamionista 0\n");
strcat(string,"{ff0000}Řidič limuzíny 150\n");
strcat(string,"{ff0000}Řidič taxíku 200\n");
strcat(string,"{ff0000}Řidič Policie 250\n");
strcat(string,"{ff0000}Sanitář Řidič 300\n");
ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"{FFD700}Povolaní Menu Body k povolaní",string,"Hrát","");
}
case 3:
{
SendClientMessage(playerid,0xFF000000,"Nemáte 200 Score");
new string[3000];
strcat(string,"{00ff00}Pilot 0\n");
strcat(string,"{00ff00}Kamionista 0\n");
strcat(string,"{ff0000}Řidič limuzíny 150\n");
strcat(string,"{ff0000}Řidič taxíku 200\n");
strcat(string,"{ff0000}Řidič Policie 250\n");
strcat(string,"{ff0000}Sanitář Řidič 300\n");
ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"{FFD700}Povolaní Menu Body k povolaní",string,"Hrát","");
}
case 4:
{
SendClientMessage(playerid,0xFF000000,"Nemáte 250 Score");
new string[3000];
strcat(string,"{00ff00}Pilot 0\n");
strcat(string,"{00ff00}Kamionista 0\n");
strcat(string,"{ff0000}Řidič limuzíny 150\n");
strcat(string,"{ff0000}Řidič taxíku 200\n");
strcat(string,"{ff0000}Řidič Policie 250\n");
strcat(string,"{ff0000}Sanitář Řidič 300\n");
ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"{FFD700}Povolaní Menu Body k povolaní",string,"Hrát","");
}
case 5:
{
SendClientMessage(playerid,0xFF000000,"Nemáte 300 Score");
new string[3000];
strcat(string,"{00ff00}Pilot 0\n");
strcat(string,"{00ff00}Kamionista 0\n");
strcat(string,"{ff0000}Řidič limuzíny 150\n");
strcat(string,"{ff0000}Řidič taxíku 200\n");
strcat(string,"{ff0000}Řidič Policie 250\n");
strcat(string,"{ff0000}Sanitář Řidič 300\n");
ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"{FFD700}Povolaní Menu Body k povolaní",string,"Hrát","");
}
}
}
}
if(dialogid == 4)
{
if(response)
{
switch(listitem)
{
case 0:
{
SetPlayerPos(playerid,1319.0760,1256.3872,10.8203);
SendClientMessage(playerid,0xFF00F0DD,"Objevil jste se letišti Las Venturas");
SendClientMessage(playerid,0xFF00F0DD,"Najdete si letadlo a začnete pilotovat");
SendClientMessage(playerid,0xFF00F0DD,"Vydělávejte a sbírejte body");
SendClientMessage(playerid,0xFF00F0DD,"A tím získáte lepší práci..");
PracePLV[playerid] = 1;
}
case 1:
{
SetPlayerPos(playerid,1319.0760,1256.3872,10.8203);
SendClientMessage(playerid,0xFF00F0DD,"Objevil jste se letišti Los Santos");
SendClientMessage(playerid,0xFF00F0DD,"Najdete si letadlo a začnete pilotovat");
SendClientMessage(playerid,0xFF00F0DD,"Vydělávejte a sbírejte body");
SendClientMessage(playerid,0xFF00F0DD,"A tím získáte lepší práci..");
PracePLV[playerid] = 1;
}
case 2:
{
SetPlayerPos(playerid,1319.0760,1256.3872,10.8203);
SendClientMessage(playerid,0xFF00F0DD,"Objevil jste se letišti San Fierro");
SendClientMessage(playerid,0xFF00F0DD,"Najdete si letadlo a začnete pilotovat");
SendClientMessage(playerid,0xFF00F0DD,"Vydělávejte a sbírejte body");
SendClientMessage(playerid,0xFF00F0DD,"A tím získáte lepší práci..");
PracePLV[playerid] = 1;
}
}
}
}
return 0;
}
stock Jmeno(playerid)
{
new n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,sizeof(n));
return n;
}
stock ID_Time( time )
{
new H,M,S,string[64];
M = time / 60;
S = time % 60;
H = M / 60;
M = M % 60;
format(string,64,"%ih %im %is",H,M,S);
return string;
}
SavePos(playerid, file[])
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
dini_FloatSet(file, "PosX",X);
dini_FloatSet(file, "PosY",Y);
dini_FloatSet(file, "PosZ",Z);
return 1;
}
LoadPos(playerid, file[])
{
new Float:X,Float:Y,Float:Z;
X = dini_Float(file, "PosX");
Y = dini_Float(file, "PosY");
Z = dini_Float(file, "PosZ");
SetPlayerPos(playerid, X, Y, Z);
pos = true;
return 1;
}
stock IsPlayerInArea(playerid, Float:x1, Float:y1, Float:x2, Float:y2)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if ((x > x1) && (x < x2) && (y > y1) && (y < y2))
return true; /* je v obdlzniku */
else
return false;
}
forward CestujiciToNaklada(playerid);
public CestujiciToNaklada(playerid)
{
new rand = random(sizeof(xx));
Proces[playerid] = SetPlayerCheckpoint(playerid, xx[rand][0], xx[rand][1],xx[rand][2],4.0);
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid,-1,"Nyní můžeš letět.");
Praces[playerid] = 0;
Praces2[playerid] = 1;
return 1;
}
forward CestujiciToNakladaLS(playerid);
public CestujiciToNakladaLS(playerid)
{
new rand = random(sizeof(xxLS));
ProcesLS[playerid] = SetPlayerCheckpoint(playerid, xxLS[rand][0], xxLS[rand][1],xxLS[rand][2],4.0);
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid,-1,"Nyní můžeš letět.");
ProcesLS[playerid] = 0;
PracesLS2[playerid] = 1;
return 1;
}
forward CestujiciToNakladaSF(playerid);
public CestujiciToNakladaSF(playerid)
{
new rand = random(sizeof(xxSF));
Proces[playerid] = SetPlayerCheckpoint(playerid, xxSF[rand][0], xxSF[rand][1],xxSF[rand][2],4.0);
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid,-1,"Nyní můžeš letět.");
ProcesSF[playerid] = 0;
PracesSF2[playerid] = 1;
return 1;
}