Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*==============================================================================
- ==============================================================================*/
- /*==============================================================================
- ==============================================================================*/
- #include <a_samp>
- #include <SII>
- #include <zcmd>
- #include <sscanf2>
- /*==============================================================================
- ==============================================================================*/
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define WHITE "{FFFFFF}"
- #define RED "{F81414}"
- #define GREEN "{00FF22}"
- #define LIGHTBLUE "{00CED1}"
- #define ORANGE "{FFAF00}"
- #define BLUE "{0025E1}"
- #define PURPLE "{FF00FF}"
- /*==============================================================================
- ==============================================================================*/
- #define DIALOG_REGISTER 2000
- #define DIALOG_LOGIN 2001
- /*==============================================================================
- ==============================================================================*/
- enum pInfo
- {
- pPass,
- pAdmin,
- pCash,
- pKills,
- pDeaths
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- new gPlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
- /*==============================================================================
- ==============================================================================*/
- stock getINI(playerid)
- {
- new account[64];
- format(account,30,"Users/%s.ini",gPlayerName[playerid]);
- return account;
- }
- /*==============================================================================
- ==============================================================================*/
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
- if (fexist(getINI(playerid)))
- {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""WHITE"Registering...",""WHITE"Type your password below to register a new account.","Register","Quit");
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(INI_Open(getINI(playerid))) {
- INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
- INI_WriteInt("Cash",GetPlayerMoney(playerid));
- INI_WriteInt("Kills",PlayerInfo[playerid][pKills]);
- INI_WriteInt("Deaths",PlayerInfo[playerid][pDeaths]);
- INI_Save();
- INI_Close();
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- PlayerInfo[killerid][pKills]++;
- PlayerInfo[playerid][pDeaths]++;
- GivePlayerMoney(killerid,1000);
- GivePlayerMoney(playerid,-1000);
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- 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 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, ""WHITE"Registering...",""RED"You have entered an invalid password.\n"WHITE"Type your password below to register a new account.","Register","Quit");
- if(INI_Open(getINI(playerid))) {
- INI_WriteString("Password",inputtext);
- INI_WriteInt("Admin",0);
- INI_WriteInt("Cash",0);
- INI_WriteInt("Kills",0);
- INI_WriteInt("Deaths",0);
- INI_Save();
- INI_Close();
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
- }
- }
- }
- case DIALOG_LOGIN:
- {
- if ( !response ) return Kick ( playerid );
- if( response )
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an invalid password.\n"WHITE"Type your password below to login.","Login","Quit");
- if(INI_Open(getINI(playerid))) {
- INI_ReadString(PlayerInfo[playerid][pPass],"Password",20);
- if(strcmp(inputtext,PlayerInfo[playerid][pPass],false)) {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""WHITE"Login",""RED"You have entered an incorrect password.\n"WHITE"Type your password below to login.","Login","Quit");
- }
- else {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""WHITE"Login",""WHITE"Type your password below to login.","Login","Quit");
- }
- PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
- GivePlayerMoney( playerid, INI_ReadInt( "Cash" ) );
- PlayerInfo[playerid][pKills] = INI_ReadInt("Kills");
- PlayerInfo[playerid][pDeaths] = INI_ReadInt("Deaths");
- INI_Close();
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- /*==============================================================================
- ZCMD and Sscanf2...
- Credits to Y_Less and Zeexs
- ==============================================================================*/
- CMD:godmodeon(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- SetPlayerHealth(playerid, 10000000);
- SetPlayerArmour(playerid, 10000000);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
- }
- return 1;
- }
- CMD:godmodeoff(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- SetPlayerHealth(playerid, 100);
- SetPlayerArmour(playerid, 100);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
- }
- return 1;
- }
- CMD:teleport(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- new ID;
- if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /tele [playerid]");
- else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
- else
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- SetPlayerPos(ID, x+1, y+1, z);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
- }
- return 1;
- }
- CMD:goto(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- new ID;
- if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [playerid]");
- else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
- else
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(ID, x, y, z);
- SetPlayerPos(playerid, x+1, y+1, z);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
- }
- return 1;
- }
- CMD:kick(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 1)
- {
- new PID, pName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME];
- if(sscanf(params, "u", PID)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid]");
- if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
- new Str[128];
- GetPlayerName(PID, pName, sizeof(pName));
- GetPlayerName(playerid, Sender, sizeof(Sender));
- format(Str, sizeof(Str), "You kicked %s!", pName);
- SendClientMessage(playerid, COLOR_LIGHTBLUE, Str);
- Kick(PID);
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
- }
- return 1;
- }
- CMD:makemeadmin(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- PlayerInfo[playerid][pAdmin] = 1;
- SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have made yourself an Admin!");
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement