Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //==============================================================================
- /*
- -New Life RolePlay
- -Skripter Joe
- -Maper Niko
- -Forum www.newlife-samp.com
- */
- //==============================================================================
- #include <a_samp>
- #include <YSI\y_ini>
- #include < foreach >
- //===============================Define boje====================================
- #define BELA "{FFFFFF}"
- #define SPLAVA "{00C0FF}"
- #define CRVENA "{F81414}"
- #define SIVA "{C0C0C0}"
- #define PROX 0xC2A2DAAA
- //==============================================================================
- //==============================Define dialozi==================================
- #define DIALOG_REGISTER 1
- #define DIALOG_LOGIN 2
- //==================================Define======================================
- #define SCM SendClientMessage
- #define SCMTA SendClientMessageToAll
- #define SPD ShowPlayerDialog
- #define DSL DIALOG_STYLE_LIST
- #define DSB DIALOG_STYLE_MSGBOX
- #define DSI DIALOG_STYLE_INPUT
- //==================================Define======================================
- #define PATH "/Korisnici/%s.ini"
- enum pInfo
- {
- pLozinka,
- pNovac,
- pUbistva,
- pLevel,
- pSmrti
- };
- new PlayerInfo[MAX_PLAYERS][pInfo];
- //==============================================================================
- new ZabranjeneReci[][] =
- {
- "CroHerze","Balkan Underground","Balkan-Underground","YUB","Yunited Balkan","YunitedBalkan",
- "Yunited-Balkan","Y-U-B","Y.U.B","Dream World","Dream-World","DreamWorld","DW","City Of Angels","City-Of-Angels","CityOfAngels",
- "Faction Game","Faction-Game","FactionGame","NooBot","Balkan Extazy","Balkan-Extazy","Balkan.Extazy","BE","adm","srv","193.112",":7777","123","691","91",
- "46.4","46","78.112.","svr","srw","admin","NB","Global-Gaming","GG","Global Gaming","GlobalGaming","Paun","Deity","server","GH",
- "Ghetto Hard","Ghetto","Srbija RP","Elitez","Balkan Elitez","moj srw","moj server","Kurac","kurac","Picka","picka","Sisa","sisa"
- };
- //==============================================================================
- main()
- {
- print("|==============================================|");
- print("| New Life RolePlay |");
- print("| NL:RP |");
- print("| GameMode By Joe |");
- print("| Forum: www.newlife-samp.com |");
- print("|==============================================|");
- }
- public OnGameModeInit()
- {
- //=======================Podesavanja i Varijable================================
- SetGameModeText("© NL:RP v1.0 By Joe");
- SendRconCommand("mapname Beograd");
- SendRconCommand("weburl www.newlife-samp.com");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- //==============================================================================
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);// Ovde stavite koordinate svog spawna
- SpawnPlayer(playerid);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","‚"BELA"_________________________________________________________\n\n"BELA"Dobrodosao/la na "SPLAVA"New Life RolePlay\n\n"BELA"Vi imate "SPLAVA"registrovan account "BELA"molimo vas da se ulogujete.\n\n"BELA"Vasu lozinku upisite u polje ispod.\n\n"BELA"Zelimo vam ugodnu igru na nasem serveru.\n\n"BELA"_________________________________________________________","Login","Exit");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registracija",""BELA"_________________________________________________________\n\n"BELA"Dobrodosao/la na "SPLAVA"New Life RolePlay\n\n"BELA"Vi nemate "CRVENA"registrovan account "BELA"molimo vas da se registrujete.\n\n"BELA"Vasu lozinku upisite u polje ispod.\n\n"BELA"Zelimo vam ugodnu igru na nasem serveru.\n\n"BELA"_________________________________________________________","Registruj se","Exit");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
- INI_WriteInt(File,"Ubistva",PlayerInfo[playerid][pUbistva]);
- INI_WriteInt(File,"Smrti",PlayerInfo[playerid][pSmrti]);
- INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]);
- INI_Close(File);
- //==============================================================================
- new rstring[120];
- switch(reason)
- {
- case 0: format(rstring, sizeof(rstring), ""SIVA"(( %s je izasao sa servera... (crash) ))", GetName(playerid));
- case 1: format(rstring, sizeof(rstring), ""SIVA"(( %s je izasao sa servera... ))", GetName(playerid));
- case 2: format(rstring, sizeof(rstring), ""SIVA"(( %s je izasao sa servera "CRVENA"(KICK/BAN)"SIVA"... ))", GetName(playerid));
- }
- ProxDetector(30.0, playerid, rstring,PROX,PROX,PROX,PROX,PROX);
- //==============================================================================
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- PlayerInfo[killerid][pUbistva]++;
- PlayerInfo[playerid][pSmrti]++;
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- for(new words; words < sizeof(ZabranjeneReci); words++)
- {
- if(strfind(text,ZabranjeneReci[words],true) != -1 ) { SCM(playerid,-1,"[NL:RP]: "CRVENA"Rjec ta je zabranjena nemozete je pisati!"); return 0; }
- }
- return 1;
- }
- 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)
- {
- 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[])
- {
- switch(dialogid)
- {
- case DIALOG_REGISTER:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registracija",""BELA"Ukucali ste pogresnu lozinku.\n\n"BELA"Ukucajte ispravnu lozinku da bi se registrovali.","Registruj se","Exit");
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Lozinka",udb_hash(inputtext));
- INI_WriteInt(File,"Novac",0);
- INI_WriteInt(File,"Ubistva",0);
- INI_WriteInt(File,"Smrti",0);
- INI_WriteInt(File,"Level",0);
- INI_Close(File);
- SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);// Ovde stavite koordinate svog spawna
- SpawnPlayer(playerid);
- }
- }
- case DIALOG_LOGIN:
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(udb_hash(inputtext) == PlayerInfo[playerid][pLozinka])
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login",""BELA"Ukucali ste pogresnu lozinku.\n\n"BELA"Ukucajte ispravnu lozinku da bi se ulogovali.","Login","Exit");
- }
- return 1;
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- //=================================Stockovi=====================================
- stock UserPath(playerid)
- {
- new string[128],playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),PATH,playername);
- return string;
- }
- stock udb_hash(buf[])
- {
- new length=strlen(buf);
- new s1 = 1;
- new s2 = 0;
- new n;
- for (n=0; n<length; n++)
- {
- s1 = (s1 + buf[n]) % 65521;
- s2 = (s2 + s1) % 65521;
- }
- return (s2 << 16) + s1;
- }
- //==============================================================================
- forward LoadUser_data(playerid,name[],value[]);
- public LoadUser_data(playerid,name[],value[])
- {
- INI_Int("Lozinka",PlayerInfo[playerid][pLozinka]);
- INI_Int("Novac",PlayerInfo[playerid][pNovac]);
- INI_Int("Ubistva",PlayerInfo[playerid][pUbistva]);
- INI_Int("Smrti",PlayerInfo[playerid][pSmrti]);
- INI_Int("Level",PlayerInfo[playerid][pLevel]);
- return 1;
- }
- //==============================================================================
- forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
- public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:posx, Float:posy, Float:posz;
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- foreach(Player,i)
- {
- if(IsPlayerConnected(i))
- {
- if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
- {
- GetPlayerPos(i, posx, posy, posz);
- tempposx = (oldposx -posx);
- tempposy = (oldposy -posy);
- tempposz = (oldposz -posz);
- if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
- {
- SendClientMessage(i, col1, string);
- }
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
- {
- SendClientMessage(i, col2, string);
- }
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
- {
- SendClientMessage(i, col3, string);
- }
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
- {
- SendClientMessage(i, col4, string);
- }
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- SendClientMessage(i, col5, string);
- }
- } }
- }
- }
- return 1;
- }
- //==============================================================================
- IsNumeric(const string[])
- {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
- //==============================================================================
- stock GetName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- //==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment