Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <YSI\y_ini>
- #include <sscanf2>
- #include <zcmd>
- // PRAGMA_--
- #pragma tabsize 0
- // DEFINES_--
- #define SCRIPT_VERSION "BSRP"
- #define DIALOGO_LOGIN 700
- #define DIALOGO_REGISTRO 701
- #define TERMS_OF_USE 702
- // MACROS_--
- #define function%0(%1) forward %0(%1); public %0(%1)
- // NEW'S_--
- new gPlayerLogTries[MAX_PLAYERS], gPlayerLogged[MAX_PLAYERS];
- new BigEar[MAX_PLAYERS];
- // COLORS_--
- #define COLOR_GRAD2 0xBFC0C2FF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_FADE1 0xE6E6E6E6
- #define COLOR_FADE2 0xC8C8C8C8
- #define COLOR_FADE3 0xAAAAAAAA
- #define COLOR_FADE4 0x8C8C8C8C
- #define COLOR_FADE5 0x6E6E6E6E
- // ENUMS_--
- enum pInfo
- {
- pKey[64],
- pLevel,
- pAdmin,
- pConnectTime,
- pCash,
- };
- new PlayerInfo[MAX_PLAYERS][pInfo];
- new playername[MAX_PLAYER_NAME];
- // CBACKS_--
- SpaceInUser(playerid, const string[])
- {
- if(IsPlayerConnected(playerid))
- {
- if(strfind(string, "=", true) != -1) return 0;
- else if(strfind(string, "\n", true) != -1) return 0;
- else return 1;
- }
- return 0;
- }
- main()
- {
- print(" Gamemode Iniciado ");
- }
- public OnGameModeInit()
- {
- SetGameModeText("ReplayHD");
- AddPlayerClass(0,2512.8611,-1673.2799,13.5104,87.7485,0,0,0,0,0,0);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new string[128];
- new PlayerN[MAX_PLAYERS]; GetPlayerName(playerid, PlayerN, sizeof(PlayerN));
- SetPlayerCameraPos(playerid,1614.3577,-2272.5510,13.5153);
- SetPlayerCameraLookAt(playerid,1614.3815,-2277.4917,13.5153);
- BigEar[playerid] = 0;
- SetPVarString(playerid, "pPass", "0") ;
- format(string, sizeof(string), "users/%s.ini", PlayerN);
- if(INI_Exist(PlayerNombre(playerid))) ShowLoginDialog(playerid);
- else ShowRegisterDialog(playerid);
- return 1;
- }
- function OnPlayerLogin(playerid)
- {
- if(PlayerInfo[playerid][pAdmin] > 0)
- SendClientMessage(playerid, -1, "Te-ai logat ca si admin");
- else
- SendClientMessage(playerid, -1, "Te-ai logat ca si user");
- TermsOfUse(playerid);
- return 1;
- }
- function 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);
- //radi = 2.0; //Trigger Radius
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
- {
- if(!BigEar[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);
- }
- }
- else
- {
- SendClientMessage(i, col1, string);
- }
- }
- }
- }//not connected
- return 1;
- }
- function OnPlayerRegister(playerid, password[])
- {
- if(IsPlayerConnected(playerid))
- {
- new
- PlayerFile[ 13 + MAX_PLAYER_NAME ];
- format( PlayerFile , sizeof PlayerFile, "users/%s.ini", PlayerNombre(playerid));
- new
- INI:PlayerAcc = INI_Open( PlayerFile );
- strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 64);
- INI_WriteString(PlayerAcc, "Password", PlayerInfo[playerid][pKey]);
- SetPlayerPos(playerid, 1730.3131,-2238.5420,13.5422);
- printf("Cont %s's Inregistrat .",PlayerNombre(playerid));
- INI_Close(PlayerAcc);
- INI_ParseFile( PlayerFile, "LoadUser", false, true, playerid, true, false );
- OnPlayerLogin(playerid);
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new string[128];
- if(dialogid == DIALOGO_LOGIN)
- {
- if (response)
- {
- if ( strlen( inputtext ) == 0 )
- {
- ShowLoginDialog(playerid);
- SendClientMessage(playerid, COLOR_GRAD2, "Pune parola pentru a te loga.");
- return 1; }
- new
- PlayerFile[ 13 + MAX_PLAYER_NAME ], PlayerPass[ 129 ];
- format( PlayerFile , sizeof PlayerFile, "users/%s.ini", PlayerNombre(playerid));
- INI_ParseFile( PlayerFile, "IdentificarPass", .bExtra = true, .extra = playerid );
- GetPVarString( playerid, "pPass", PlayerPass, 129 );
- if(!strcmp(PlayerPass, inputtext))
- {
- format( PlayerFile , sizeof PlayerFile, "users/%s.ini", PlayerNombre(playerid));
- INI_ParseFile( PlayerFile, "LoadUser", false, true, playerid, true, false );
- OnPlayerLogin(playerid);
- }
- else
- {
- ShowLoginDialog(playerid);
- gPlayerLogTries[playerid] ++;
- format(string, sizeof(string), "Error: Parola gresita, Incercari {FF0000}(%d/3", gPlayerLogTries[playerid]);
- SendClientMessage(playerid, COLOR_GRAD2, string);
- SendClientMessage(playerid, COLOR_GRAD2, "Daca ti-ai uitat parola intra pe forum. (forum.com).");
- if(gPlayerLogTries[playerid] == 9)
- {
- SendClientMessage(playerid, COLOR_GRAD2, "Server Closed Connection");
- Kick(playerid);
- }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "Probleme cu logarea ? Intra pe forum (forum.com).");
- Kick(playerid);
- }
- }
- if(dialogid == TERMS_OF_USE)
- {
- if(response)
- {
- gPlayerLogged[playerid] = 1;
- SpawnPlayer(playerid);
- }
- else TermsOfUse(playerid);
- }
- if(dialogid == DIALOGO_REGISTRO)
- {
- if (response)
- {
- if (sscanf(inputtext, "s[20]", inputtext[0]))
- {
- SendClientMessage(playerid, COLOR_GRAD2, "Doar 6-20 Litere.");
- ShowRegisterDialog(playerid); return 1;
- }
- if (strlen(inputtext) < 6 || strlen(inputtext) > 20 )
- {
- SendClientMessage(playerid, COLOR_GRAD2, "Doar 6-20 Litere.");
- ShowRegisterDialog(playerid); return 1;
- }
- if(SpaceInUser(playerid, inputtext) == 1)
- {
- OnPlayerRegister(playerid, inputtext);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "Doar 6-20 Litere.");
- ShowRegisterDialog(playerid);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GRAD2, "Multumim ca ne-ai vizitat ! Te mai asteptam !");
- Kick(playerid);
- }
- }
- return 1;
- }
- stock TermsOfUse(playerid)
- {
- new INFORMACION[] =" \n {45F86C} Cititi regulamentul de pe forum.com ";
- SetPlayerHealth(playerid, 50);
- ShowPlayerDialog(playerid, TERMS_OF_USE,DIALOG_STYLE_MSGBOX, "{FFFFFF}ReplayHD - Information", INFORMACION, "Play", "" );
- }
- PlayerNombre( playerid )
- {
- new xName[ MAX_PLAYER_NAME ];
- GetPlayerName( playerid, xName, sizeof( xName ) );
- return xName;
- }
- INI_Exist(nickname[])
- {
- new tmp[128];
- format(tmp,sizeof(tmp),"users/%s.ini", nickname);
- return fexist(tmp);
- }
- ShowLoginDialog(playerid)
- {
- new
- title[] = "ReplayHD - Login",
- string[512],
- str[128]
- ;
- strcat(string, "Bun venit pe ReplayHD");
- format(str, sizeof str, "\n{FFFFFF}Contul tau: %s \n\t\t Deja inregistrat!! \n\t Connect!", PlayerNombre(playerid));
- strcat(string, str);
- ShowPlayerDialog(playerid, DIALOGO_LOGIN, DIALOG_STYLE_INPUT, title, string, "Login", "Iesi");
- return 1;
- }
- ShowRegisterDialog(playerid)
- {
- new
- title[] = "ReplayHD - Login",
- string[512],
- str[128]
- ;
- strcat(string, "Welcome to: ReplayHD");
- format(str, sizeof str, "{FFFFFF}Introdu parola pentru a te loga %s", PlayerNombre(playerid));
- strcat(string, str);
- ShowPlayerDialog(playerid, DIALOGO_REGISTRO, DIALOG_STYLE_INPUT, title, string, "Register", "Iesi");
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(gPlayerLogged[playerid] == 0)
- {
- SendClientMessage(playerid, COLOR_GRAD2, "** ReplayHD: Trebuie sa te inregistrezi pentru a te juca **");
- Kick(playerid);
- }
- return 1;
- }
- function LoadUser(playerid, name[], value[])
- {
- INI_Int( "Level", PlayerInfo[playerid][pLevel]);
- INI_Int( "Staff_Level", PlayerInfo[playerid][pAdmin]);
- INI_Int( "ConnectTime", PlayerInfo[playerid][pConnectTime]);
- INI_Int( "Money", PlayerInfo[playerid][pCash] );
- return 0;
- }
- function OnPlayerText(playerid, text[])
- {
- new sendername[MAX_PLAYER_NAME];
- new string[128];
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string,sizeof(string),"%s Says: %s", sendername,text);
- ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
- return 0;
- }
- function IdentificarPass( playerid, name[ ], value[ ] )
- {
- if ( ! strcmp( name, "Password" ) ) SetPVarString( playerid, "pPass", value ) ;
- }
- function OnPlayerUpdateTime(playerid)
- {
- if(INI_Exist(PlayerNombre(playerid)) && gPlayerLogged[playerid] == 1)
- {
- new
- PlayerFile[ 13 + MAX_PLAYER_NAME + 1];
- format( PlayerFile , sizeof PlayerFile, "users/%s.ini", PlayerNombre(playerid));
- new
- INI:PlayerAcc = INI_Open( PlayerFile );
- INI_WriteInt( PlayerAcc, "Staff_Level", PlayerInfo[playerid][pAdmin] );
- INI_WriteInt( PlayerAcc, "Level", PlayerInfo[playerid][pLevel] );
- INI_WriteInt( PlayerAcc, "ConnectTime", PlayerInfo[playerid][pConnectTime] );
- INI_WriteInt( PlayerAcc, "Money", GetPlayerMoney( playerid ) );
- INI_Close( PlayerAcc );
- }
- return 1;
- }
- Log(sz_fileName[], sz_input[]) {
- new
- sz_logEntry[156],
- i_dateTime[2][3],
- File: fileHandle = fopen(sz_fileName, io_append);
- gettime(i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2]);
- getdate(i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2]);
- format(sz_logEntry, sizeof(sz_logEntry), "[%i/%i/%i - %i:%i:%i] %s\r\n", i_dateTime[1][0], i_dateTime[1][1], i_dateTime[1][2], i_dateTime[0][0], i_dateTime[0][1], i_dateTime[0][2], sz_input);
- fwrite(fileHandle, sz_logEntry);
- return fclose(fileHandle);
- }
- // COMENZI_--
- CMD:makeadmin(playerid, params[]){
- if(PlayerInfo[playerid][pAdmin] <= 3) return SendClientMessage(playerid, COLOR_GREY, "Nu esti admin");
- if(!sscanf(params, "ui", params[0], params[1])){
- new string[128];
- PlayerInfo[params[0]][pAdmin] = params[1];
- format(string, sizeof(string), "ATENTIE: Ii dai lui: %s Admin level: %d",PlayerNombre(params[0]), params[1]);
- SendClientMessage(playerid, COLOR_GRAD2, string);
- Log("logs/Cadministrativos.log", string);
- OnPlayerUpdateTime(playerid);
- } else SendClientMessage(playerid, COLOR_GRAD2, "FOLOSIRE: /makeadmin <ID> <Level>.");
- return 1;
- }
- CMD:givemoney(playerid, params[]){
- if(PlayerInfo[playerid][pAdmin] <= 3) return SendClientMessage(playerid, COLOR_GREY, "Nu esti un admin.");
- if(!sscanf(params, "ui", params[0], params[1])){
- GivePlayerMoney(params[0], params[1]);
- } else SendClientMessage(playerid, COLOR_GRAD2, "FOLOSIRE: /givemoney <ID> <Value>.");
- return 1;
- }
- CMD:ah(playerid, params[]){
- if(PlayerInfo[playerid][pAdmin] <= 3) return SendClientMessage(playerid, COLOR_GREY, "Nu esti un admin");
- SendClientMessage(playerid, COLOR_GRAD2, "Admin Help");
- SendClientMessage(playerid, COLOR_GRAD2, "/makeadmin /bigears /givemoney");
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 2167.0342, -1672.6652, 15.0757);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- return 1;
- }
- return 0;
- }
- 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 OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment