Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Crystal LifeRolePlay
- Scripter: Dino Delkic
- Maper: Refik Bacic
- */
- #include <a_samp>
- #include <YSI\y_ini>
- #include <zcmd>
- #include <sscanf2>
- #include <streamer>
- #define DIALOG_REGISTER 1
- #define DIALOG_LOGIN 2
- #define PATH "/Users/%s.ini"
- #define COL_WHITE "{FFFFFF}"
- #define COL_RED "{F81414}"
- #define COL_GREEN "{00FF22}"
- #define COL_LIGHTBLUE "{00CED1}"
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_FADE5 0x6E6E6E6E
- #define COLOR_PURPLE 0xC2A2DAAA
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_SYNTAX 0xFFFFFFFF
- #define SCM SendClientMessage
- #define SPD ShowPlayerDialog
- #define SPC SetPlayerCheckpoint
- #define DPC DisablePlayerCheckpoint
- /* new */
- new BigEar[MAX_PLAYERS];
- enum pInfo
- {
- pPass,
- pNovac,
- pAdmin,
- pGodine,
- pZemlja,
- pPosao
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- forward LoadUser_data(playerid,name[],value[]);
- public LoadUser_data(playerid,name[],value[])
- {
- INI_Int("Password",PlayerInfo[playerid][pPass]);
- INI_Int("Novac",PlayerInfo[playerid][pNovac]);
- INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
- INI_Int("Godine",PlayerInfo[playerid][pGodine]);
- INI_Int("Zemlja",PlayerInfo[playerid][pZemlja]);
- return 1;
- }
- stock UserPath(playerid)
- {
- new string[128],playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),PATH,playername);
- return string;
- }
- /*Credits to Dracoblue*/
- 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;
- }
- main()
- {
- print("\n---------------------------------------");
- print(" Crystal Lide Roleplay ");
- print(" By Dino ");
- print("-----------------------------------------\n");
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- /* Reg/log sistem */
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Upisite svoj password da se ulogujete.","Login","Odustani");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registracija",""COL_WHITE"Upisite password da se registrujete.","Register","Odustani");
- }
- /* Poslovi */
- public OnPlayerDisconnect(playerid, reason)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
- INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
- INI_WriteInt(File,"Godine",PlayerInfo[playerid][pGodine]);
- INI_WriteInt(File,"Zemlja",PlayerInfo[playerid][pZemlja]);
- INI_WriteInt(File,"Posao",PlayerInfo[playerid][pPosao]);
- INI_Close(File);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- 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, ""COL_WHITE"Registracija",""COL_RED"Ukucali ste pogresan password.\n"COL_WHITE"Upisite password da registrujete vas racun.","Register","Quit");
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Password",udb_hash(inputtext));
- INI_WriteInt(File,"Novac",0);
- INI_WriteInt(File,"Admin",0);
- INI_WriteInt(File,"Zemlja",0);
- INI_WriteInt(File,"Godine",0);
- INI_WriteInt(File,"Posao",0);
- INI_Close(File);
- SetSpawnInfo(playerid, 0, 0, );
- SpawnPlayer(playerid);
- }
- }
- case DIALOG_LOGIN:
- {
- if ( !response ) return Kick ( playerid );
- if( response )
- {
- if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- GivePlayerMoney(playerid, PlayerInfo[playerid][pNovac]);
- SetSpawnInfo(playerid, 0, 0, 821.7203, -1342.0150, 13.5196, 93.1352, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Ukucali ste pogresan password\n"COL_WHITE"Upisite password da se ulogujete.","Login","Izlaz");
- }
- return 1;
- }
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- stock 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;
- new invehicle[MAX_PLAYERS];
- new virtualworld = GetPlayerVirtualWorld(playerid);
- new interior = GetPlayerInterior(playerid);
- new vehicleid = GetPlayerVehicleID(playerid);
- new ivehicleid;
- if(vehicleid)
- {
- GetVehiclePos(vehicleid,oldposx,oldposy,oldposz);
- }
- else
- {
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- vehicleid = GetPlayerVehicleID(playerid);
- }
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(!BigEar[i])
- {
- if(GetPlayerVirtualWorld(i) == virtualworld)
- {
- if((GetPlayerInterior(i) == interior))
- {
- if(vehicleid)
- {
- if(IsPlayerInVehicle(i,vehicleid)) invehicle[i] = 1;
- }
- if(!invehicle[i])
- {
- if(IsPlayerInAnyVehicle(i))
- {
- ivehicleid = GetPlayerVehicleID(i);
- GetVehiclePos(ivehicleid,posx,posy,posz);
- }
- else
- {
- 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))) SCM(i, col1, string);
- else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) SCM(i, col2, string);
- else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) SCM(i, col3, string);
- else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) SCM(i, col4, string);
- else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) SCM(i, col5, string);
- }
- else SCM(i, col1, string);
- }
- }
- }
- else SCM(i, col1, string);
- }
- }
- }
- return 1;
- }
- stock PlayerName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- /* ------------------Komande-------------------- */
- /* Osnovne RP komande*/
- CMD:b(playerid,params[])
- {
- if(isnull(params)) return SCM(playerid, COLOR_SYNTAX,"[CMD]: /b [lokalni ooc chat]");
- new sendername[MAX_PLAYER_NAME], string[128];
- GetPlayerName(playerid,sendername,sizeof(sendername));
- sendername[strfind(sendername,"_")] = ' ';
- format(string, sizeof(string), "((%s: %s ))", sendername, params);
- ProxDetector(30.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
- return 1;
- }
- CMD:s(playerid,params[])
- {
- if(isnull(params)) return SCM(playerid, COLOR_SYNTAX,"[CMD]: /s [glasno]");
- new sendername[MAX_PLAYER_NAME], string[128];
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "%s se dere: %s!!", sendername, params);
- ProxDetector(60.0, playerid, string, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5);
- return 1;
- }
- CMD:l(playerid,params[])
- {
- if(isnull(params)) return SCM(playerid, COLOR_SYNTAX,"[CMD]:/l [tiho]");
- new sendername[MAX_PLAYER_NAME], string[128];
- GetPlayerName(playerid,sendername,sizeof(sendername));
- sendername[strfind(sendername,"_")] = ' ';
- format(string,sizeof(string), "%s :[Tiho] %s", sendername, params);
- ProxDetector(3.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
- return 1;
- }
- CMD:me(playerid, params[])
- {
- new name[MAX_PLAYER_NAME], str[128];
- GetPlayerName(playerid, name, sizeof(name));
- if(isnull(params))
- return SCM(playerid,COLOR_SYNTAX -1,"[CMD]: /me [akcija]");
- format(str,sizeof(str),"*%s %s",name, params);
- ProxDetector(30.0, playerid, str, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment