Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include zcmd
- #include foreach
- #include Dini
- #define Path "manhunt/accounts/%s.sto"
- #define Version "0.4"
- #define LastUpdate "22st, October, 2011"
- #define Authors "admantis & Mecaurio"
- #define LOGIN_DIALOG 1
- #define REGISTER_DIALOG 2
- #define REGISTER2_DIALOG 3
- #define SETTINGS_DIALOG 4
- #define SKIN_DIALOG 5
- #define LOCKACC_DIALOG 6
- #define HELP_DIALOG 7
- #define MSG_DIALOG 0
- main(){}
- enum xx
- {
- bool:LoggedIn,
- Score,
- Money,
- Muted,
- Locked,
- Aislated,
- Level,
- Skin,
- PlayingMinutes,
- Hunts,
- HuntedTimes,
- DonatorLevel,
- // due below, variables don't save in a file
- LoginAttempts,
- }
- new PlayerInfo[MAX_PLAYERS][xx];
- new ManhuntVictim;
- new ManhuntVictimName[24];
- new ManhuntReward[2]; // 0 : score | 1 : money
- new TotalPlayers = 0;
- new Text:Textdraw0;
- new Text:Textdraw1;
- new Text:Textdraw2;
- new Text:Textdraw3;
- new Text:Textdraw4;
- new Text:Textdraw5;
- new Float:RandomSpawn[][4] =
- {
- {713.1885,1195.6671,13.3964,276.8443},
- {-84.7373,1378.8387,10.2734,350.3290},
- {-317.1604,1052.4156,20.3403,9.2268},
- {-314.4944,1773.9430,43.6406,139.5658},
- {-857.3574,1536.6853,22.5870,307.9844},
- {-783.6329,1446.7645,13.9453,162.7717},
- {-1441.6185,2636.1814,55.8359,239.6728},
- {-778.0161,2759.9465,45.6930,193.9529},
- {-271.9291,2715.1750,62.6875,272.6671},
- {-251.6501,2599.9866,62.8582,293.7300}
- };
- native sscanf(const data[], const format[], {Float,_}:...);
- native unformat(const data[], const format[], {Float,_}:...) = sscanf;
- // Native publics
- public OnGameModeInit()
- {
- for( new i = 0; i < 7; i ++ ) { printf( " " ); }
- printf(" ... loading sequence initialized ... ");
- printf(" ... loading static vehicles ... " );
- LoadStaticVehiclesFromFile( "manhunt/vehicles/bone.txt" );
- LoadStaticVehiclesFromFile( "manhunt/vehicles/flint.txt" );
- LoadStaticVehiclesFromFile( "manhunt/vehicles/lv_airport.txt" );
- LoadStaticVehiclesFromFile( "manhunt/vehicles/lv_law.txt" );
- LoadStaticVehiclesFromFile( "manhunt/vehicles/lv_gen.txt" );
- LoadStaticVehiclesFromFile( "manhunt/vehicles/tierra.txt" );
- LoadStaticVehiclesFromFile( "manhunt/vehicles/trains.txt" );
- LoadStaticVehiclesFromFile( "manhunt/vehicles/whetstone.txt" );
- printf(" ... creating graphics ... ");
- Textdraw0 = TextDrawCreate(810.000000, 84.000000, "New Textdraw");
- TextDrawBackgroundColor(Textdraw0, 255);
- TextDrawFont(Textdraw0, 1);
- TextDrawLetterSize(Textdraw0, 0.800000, 15.000000);
- TextDrawColor(Textdraw0, 572662306);
- TextDrawSetOutline(Textdraw0, 0);
- TextDrawSetProportional(Textdraw0, 1);
- TextDrawSetShadow(Textdraw0, 1);
- TextDrawUseBox(Textdraw0, 1);
- TextDrawBoxColor(Textdraw0, 180);
- TextDrawTextSize(Textdraw0, -8.000000, -229.000000);
- Textdraw1 = TextDrawCreate(258.000000, 95.000000, "The Manhunt");
- TextDrawBackgroundColor(Textdraw1, 1721355519);
- TextDrawFont(Textdraw1, 1);
- TextDrawLetterSize(Textdraw1, 0.529999, 1.799999);
- TextDrawColor(Textdraw1, 255);
- TextDrawSetOutline(Textdraw1, 1);
- TextDrawSetProportional(Textdraw1, 1);
- Textdraw2 = TextDrawCreate(70.000000, 307.000000, "Easy concept; random player is chosen, he is hunted down.");
- TextDrawBackgroundColor(Textdraw2, 1721355519);
- TextDrawFont(Textdraw2, 1);
- TextDrawLetterSize(Textdraw2, 0.500000, 1.399999);
- TextDrawColor(Textdraw2, 255);
- TextDrawSetOutline(Textdraw2, 1);
- TextDrawSetProportional(Textdraw2, 1);
- Textdraw3 = TextDrawCreate(130.000000, 322.000000, "Kill him, and become the new manhunt victim.");
- TextDrawBackgroundColor(Textdraw3, 1721355519);
- TextDrawFont(Textdraw3, 1);
- TextDrawLetterSize(Textdraw3, 0.500000, 1.299999);
- TextDrawColor(Textdraw3, 255);
- TextDrawSetOutline(Textdraw3, 1);
- TextDrawSetProportional(Textdraw3, 1);
- Textdraw4 = TextDrawCreate(150.000000, 336.000000, "For how long you will survive? Play now!");
- TextDrawBackgroundColor(Textdraw4, 1721355519);
- TextDrawFont(Textdraw4, 1);
- TextDrawLetterSize(Textdraw4, 0.500000, 1.200000);
- TextDrawColor(Textdraw4, 255);
- TextDrawSetOutline(Textdraw4, 1);
- TextDrawSetProportional(Textdraw4, 1);
- Textdraw5 = TextDrawCreate(432.000000, 430.000000, "Developed by admantis");
- TextDrawBackgroundColor(Textdraw5, 16777215);
- TextDrawFont(Textdraw5, 1);
- TextDrawLetterSize(Textdraw5, 0.500000, 1.000000);
- TextDrawColor(Textdraw5, 255);
- TextDrawSetOutline(Textdraw5, 1);
- TextDrawSetProportional(Textdraw5, 1);
- TextDrawUseBox(Textdraw5, 1);
- TextDrawBoxColor(Textdraw5, 255);
- TextDrawTextSize(Textdraw5, 635.000000, 0.000000);
- printf(" ... fixing variables, it should take a few miliseconds ... ");
- SetGameModeText("The Manhunt");
- SendRconCommand("mapname www.volt-host.com" );
- ManhuntVictim = -1;
- ManhuntVictimName = "";
- TotalPlayers = 0;
- ManhuntReward[0] = 0;
- ManhuntReward[1] = 0;
- printf(" ... loading sequence finished, ready to play ... " );
- printf(" ... displaying build information ... ");
- printf(" ... version: %s ... ", Version );
- printf(" ... last update: %s ...", LastUpdate );
- printf(" ... authors: %s ...", Authors );
- for( new i = 0; i < 7; i ++ ) { printf( " " ); }
- return 1;
- }
- public OnPlayerSpawn( playerid )
- {
- TextDrawHideForPlayer( playerid, Textdraw0 );
- TextDrawHideForPlayer( playerid, Textdraw1 );
- TextDrawHideForPlayer( playerid, Textdraw2 );
- TextDrawHideForPlayer( playerid, Textdraw3 );
- TextDrawHideForPlayer( playerid, Textdraw4 );
- TextDrawHideForPlayer( playerid, Textdraw5 );
- new szString[128];
- new rand = random(sizeof(RandomSpawn));
- SetPlayerPos( playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2] );
- SetPlayerFacingAngle( playerid, RandomSpawn[rand][3] );
- SetPlayerSkin( playerid, PlayerInfo[playerid][Skin] );
- if ( ManhuntVictim == -1 )
- {
- ManhuntReward[0] = Random( 1, 15 );
- ManhuntReward[1] = Random( 500, 2000 );
- ManhuntVictim = playerid;
- ManhuntVictimName = GetName( playerid );
- SetPlayerColor( playerid, 0xFF0000FF );
- format( szString, 128, "{FF0000}A new manhunt started! Pursuit and kill %s to win %d score and $%d!", GetName( playerid ), ManhuntReward[0], ManhuntReward[1] );
- SendClientMessageToAll( -1, szString );
- }
- if ( IsManhuntVictim ( playerid ) )
- {
- SendClientMessage( playerid, -1, "{F08080}You are the Manhunt Victim. Don't let anyone kill you! ");
- GivePlayerWeapon( playerid, Random( 22, 24 ), Random( 100, 300 ) );
- GivePlayerWeapon( playerid, Random( 28, 32 ), Random( 100, 300 ) );
- GivePlayerWeapon( playerid, Random( 4, 9 ), 1 );
- SetPlayerArmour( playerid, Random( 25, 50 ) );
- }
- else
- {
- format( szString, 128, "{F08080}Kill %s to win %d score and $%d. There might be competition!", ManhuntVictimName, ManhuntReward[0], ManhuntReward[1] );
- SendClientMessage( playerid, -1, szString );
- GivePlayerWeapon( playerid, Random( 22, 24 ), Random( 100, 300 ) );
- GivePlayerWeapon( playerid, Random( 28, 32 ), Random( 100, 300 ) );
- GivePlayerWeapon( playerid, Random( 4, 9 ), 1 );
- SetPlayerArmour( playerid, Random( 10, 30 ) );
- }
- if ( !IsPlayerConnected ( ManhuntVictim ) && ManhuntVictim > 0 )
- {
- ManhuntReward[0] = Random( 1, 15 );
- ManhuntReward[1] = Random( 500, 2000 );
- ManhuntVictim = playerid;
- ManhuntVictimName = GetName( playerid );
- SetPlayerColor( playerid, 0xFF0000FF );
- format( szString, 128, "{FF0000}A new manhunt started! Pursuit and kill %s to win %d score and $%d!", GetName( playerid ), ManhuntReward[0], ManhuntReward[1] );
- SendClientMessageToAll( -1, szString );
- }
- if ( !IsPlayerConnected ( ManhuntVictim ) && ManhuntVictim != -1)
- {
- new randplayer = GetRandomPlayer();
- ManhuntReward[0] = Random( 1, 15 );
- ManhuntReward[1] = Random( 500, 2000 );
- ManhuntVictim = randplayer;
- ManhuntVictimName = GetName( randplayer );
- SetPlayerColor( randplayer, 0xFF0000FF );
- format( szString, 128, "{FF0000}%s is now the new manhunt victim! Kill them to win %d score and $%d!", GetName( randplayer ), ManhuntReward[0], ManhuntReward[1] );
- SendClientMessageToAll( -1, szString );
- printf(" ... new manhunt victim %s (id%d) reward %d and $%d", GetName( randplayer ), randplayer, ManhuntReward[0], ManhuntReward[1] );
- }
- if ( GetPlayerSkin( playerid ) == 0 )
- {
- SetPlayerSkin( playerid, 29 );
- }
- return 1;
- }
- public OnPlayerDeath( playerid, killerid, reason )
- {
- new szString[ 128 ];
- if ( IsManhuntVictim ( playerid ) )
- {
- if ( killerid == INVALID_PLAYER_ID )
- {
- format( szString, 128, "{6699CC}The manhunt victim %s died in an accident. Starting new manhunt round!", GetName( playerid ) );
- SendClientMessageToAll( -1, szString );
- new randplayer = GetRandomPlayer();
- ManhuntReward[0] = Random( 1, 15 );
- ManhuntReward[1] = Random( 500, 2000 );
- ManhuntVictim = randplayer;
- ManhuntVictimName = GetName( randplayer );
- SetPlayerColor( randplayer, 0xFF0000FF );
- format( szString, 128, "{FF0000}%s is now the new manhunt victim! Kill them to win %d score and $%d!", GetName( randplayer ), ManhuntReward[0], ManhuntReward[1] );
- SendClientMessageToAll( -1, szString );
- printf(" ... new manhunt victim %s (id%d) reward %d and $%d", GetName( randplayer ), randplayer, ManhuntReward[0], ManhuntReward[1] );
- }
- else
- {
- format( szString, 128, "{6699CC}The manhunt victim %s has been killed by %s and has became the new manhunt victim. ", GetName( playerid ), GetName( killerid ) );
- SendClientMessageToAll( -1, szString );
- ManhuntReward[0] = Random( 1, 15 );
- ManhuntReward[1] = Random( 500, 2000 );
- ManhuntVictim = killerid;
- ManhuntVictimName = GetName( killerid );
- PlayerInfo[killerid][Hunts] += 1;
- PlayerInfo[playerid][HuntedTimes] += 1;
- SetPlayerScore( killerid, ManhuntReward[0] );
- GivePlayerMoney( killerid, ManhuntReward[1] );
- SetPlayerColor( killerid, 0xFF0000FF );
- format( szString, 128, "{FF0000}A new manhunt started! Pursuit and kill %s to win %d score and $%d!", GetName( killerid ), ManhuntReward[0], ManhuntReward[1] );
- SendClientMessageToAll( -1, szString );
- printf(" ... new manhunt victim %s (id%d) reward %d and $%d", GetName( killerid ), killerid, ManhuntReward[0], ManhuntReward[1] );
- }
- }
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new szString[128];
- if ( PlayerInfo[playerid][LoggedIn] == true )
- {
- new szFile[128];
- format( szFile, 128, Path, GetName( playerid ) );
- if ( fexist ( szFile ) )
- {
- dini_IntSet( szFile, "Score", GetPlayerScore( playerid ) );
- dini_IntSet( szFile, "Money", GetPlayerMoney( playerid ) );
- dini_IntSet( szFile, "Muted", PlayerInfo[playerid][Muted] );
- dini_IntSet( szFile, "Locked", PlayerInfo[playerid][Locked] );
- dini_IntSet( szFile, "Aislated", PlayerInfo[playerid][Aislated] );
- dini_IntSet( szFile, "Level", PlayerInfo[playerid][Level] );
- dini_IntSet( szFile, "Skin", GetPlayerSkin( playerid ) );
- dini_IntSet( szFile, "PlayingMinutes", PlayerInfo[playerid][PlayingMinutes] );
- dini_IntSet( szFile, "Hunts", PlayerInfo[playerid][Hunts] );
- dini_IntSet( szFile, "HuntedTimes", PlayerInfo[playerid][HuntedTimes] );
- dini_IntSet( szFile, "DonatorLevel", PlayerInfo[playerid][DonatorLevel] );
- }
- }
- if ( ManhuntVictim == playerid )
- {
- if ( TotalPlayers == 1 )
- {
- ManhuntVictim = -1;
- ManhuntVictimName = "";
- ManhuntReward[0] = 0;
- ManhuntReward[1] = 0;
- printf(" ... manhunt victim %s (id%d) left the server ...", GetName(playerid), playerid);
- printf(" ... couldn't start new manhunt, no online players, waiting for players ... ");
- }
- else
- {
- new randplayer = GetRandomPlayer();
- ManhuntReward[0] = Random( 1, 15 );
- ManhuntReward[1] = Random( 500, 2000 );
- ManhuntVictim = randplayer;
- ManhuntVictimName = GetName( randplayer );
- SetPlayerColor( randplayer, 0xFF0000FF );
- format( szString, 128, "{FF0000}%s is now the new manhunt victim! Kill them to win %d score and $%d!", GetName( randplayer ), ManhuntReward[0], ManhuntReward[1] );
- SendClientMessageToAll( -1, szString );
- printf(" ... %s left so %s (id%d) is now the hunt victim reward %d score & $%d money ...", playerid, ManhuntVictimName, ManhuntVictim, ManhuntReward[0], ManhuntReward[1] );
- }
- }
- if (reason)
- {
- if ( reason == 0 ) format( szString, 128, "{9ACD32} * %s has disconnected from the server (Timeout).", GetName( playerid ) );
- else if ( reason == 1 ) format( szString, 128, "{9ACD32} * %s has disconnected from the server (Leaving).", GetName( playerid ) );
- else if ( reason == 2 ) format( szString, 128, "{9ACD32} * %s has disconnected from the server (Kicked or Banned).", GetName( playerid ) );
- SendClientMessageToAll( -1, szString );
- }
- TotalPlayers -= 1;
- return 1;
- }
- public OnPlayerConnect( playerid )
- {
- TotalPlayers += 1;
- ClearChat( false, playerid ); ClearChat( false, playerid ); ClearChat( false, playerid );
- TextDrawShowForPlayer( playerid, Textdraw0 );
- TextDrawShowForPlayer( playerid, Textdraw1 );
- TextDrawShowForPlayer( playerid, Textdraw2 );
- TextDrawShowForPlayer( playerid, Textdraw3 );
- TextDrawShowForPlayer( playerid, Textdraw4 );
- TextDrawShowForPlayer( playerid, Textdraw5 );
- PlayerInfo[playerid][LoggedIn] = false;
- TogglePlayerSpectating( playerid, 1 );
- SetPlayerPos( playerid, 340.3234,1734.9473,70.2102 );
- SetPlayerCameraPos( playerid, 340.3234,1734.9473,70.2102 );
- SetPlayerCameraLookAt( playerid, 187.8685,1897.0536,34.3850 );
- new szFile[128];
- format( szFile, 128, Path, GetName( playerid ) );
- if ( fexist ( szFile ) )
- {
- if ( dini_Int ( szFile, "Locked" ) != 0 )
- {
- SendClientMessage( playerid, -1, "Account Locked.");
- SendClientMessage( playerid, -1, "If you think this is an unfair lock, post a ban appeal in our forums.");
- printf(" ... %s (id%d) couldn't join because he/she is locked ...", GetName( playerid ), playerid );
- Kick( playerid );
- }
- ShowPlayerDialog( playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "{6699CC}Dear Manhunt Member", "{FFFFFF}This account is registered. To log in, input the password in the field.", "Log In", "Quit" );
- }
- else if ( !fexist ( szFile ) )
- {
- ShowPlayerDialog( playerid, REGISTER_DIALOG, DIALOG_STYLE_INPUT, "{6699CC}Dear SA-MP Player", "{FFFFFF}This account is not registered. To register, input the password in the field.\nRemember this is a English only server!", "Register", "Quit" );
- }
- SendClientMessage(playerid, 0x0000FFFF, "Welcome to Manhunt. Server is only available to testers and is in development.");
- format( szFile, 128, "{9ACD32} * %s has joined the server.", GetName( playerid ) );
- SendClientMessageToAll( -1, szFile );
- return 1;
- }
- public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] )
- {
- switch( dialogid )
- {
- case REGISTER_DIALOG:
- {
- if ( !strlen ( inputtext ) )
- {
- ShowPlayerDialog( playerid, REGISTER_DIALOG, DIALOG_STYLE_INPUT, "{FF0000}Unacceptable Password! Too short or too long.", "{FFFFFF}This account is not registered. To register, input the password in the field.\nRemember this is a English only server!", "Register", "Quit" );
- return 1;
- }
- ShowPlayerDialog( playerid, REGISTER2_DIALOG, DIALOG_STYLE_MSGBOX, "{00FF00}Account Registered!", "{FFFFFF}Thanks for registering in Manhunt!\nYou can change your account settings with /settings", "OK", "" );
- new szFile[128];
- format( szFile, 128, Path, GetName( playerid ) );
- GivePlayerMoney( playerid, 1000 );
- SetPlayerScore( playerid, 10 );
- SetPlayerSkin( playerid, 1 );
- PlayerInfo[playerid][Skin] = 1;
- dini_Create( szFile );
- dini_Set( szFile, "Password", inputtext );
- dini_IntSet( szFile, "Score", GetPlayerScore( playerid ) );
- dini_IntSet( szFile, "Money", GetPlayerMoney( playerid ) );
- dini_IntSet( szFile, "Muted", 0 );
- dini_IntSet( szFile, "Locked", 0 );
- dini_IntSet( szFile, "Aislated", 0 );
- dini_IntSet( szFile, "Level", 0 );
- dini_IntSet( szFile, "Skin", GetPlayerSkin( playerid ) );
- dini_IntSet( szFile, "PlayingMinutes", 1 );
- dini_IntSet( szFile, "Hunts", 0 );
- dini_IntSet( szFile, "HuntedTimes", 0 );
- dini_IntSet( szFile, "DonatorLevel", 0 );
- PlayerInfo[playerid][LoggedIn] = true;
- printf(" ... %s (id%d) registered account", GetName( playerid ), playerid);
- return 1;
- }
- case LOGIN_DIALOG:
- {
- if ( response)
- {
- new szFile[128], Checker[128];
- format( szFile, 128, Path, GetName( playerid ) );
- Checker = dini_Get( szFile, "Password" );
- if ( !strcmp ( inputtext, Checker, false ) )
- {
- PlayerInfo[playerid][Score] = dini_Int( szFile, "Score" );
- PlayerInfo[playerid][Money] = dini_Int( szFile, "Money" );
- PlayerInfo[playerid][Muted] = dini_Int( szFile, "Muted" );
- PlayerInfo[playerid][Locked] = dini_Int( szFile, "Locked" );
- PlayerInfo[playerid][Aislated] = dini_Int( szFile, "Aislated" );
- PlayerInfo[playerid][Level] = dini_Int( szFile, "Level" );
- PlayerInfo[playerid][Skin] = dini_Int( szFile, "Skin" );
- PlayerInfo[playerid][PlayingMinutes] = dini_Int( szFile, "PlayingMinutes" );
- PlayerInfo[playerid][Hunts] = dini_Int( szFile, "Hunts" );
- PlayerInfo[playerid][HuntedTimes] = dini_Int( szFile, "HuntedTimes" );
- PlayerInfo[playerid][DonatorLevel] = dini_Int( szFile, "DonatorLevel" );
- SetPlayerScore( playerid, PlayerInfo[playerid][Score] );
- GivePlayerMoney( playerid, ( -GetPlayerMoney( playerid ) ) + PlayerInfo[playerid][Money] );
- SetPlayerSkin( playerid, PlayerInfo[playerid][Skin] );
- TogglePlayerSpectating( playerid, 0 );
- SetSpawnInfo( playerid, 0, PlayerInfo[playerid][Skin], 3.0, 3.0, 10.0, 360.0, 0, 0, 0, 0, 0, 0 );
- SpawnPlayer( playerid );
- PlayerInfo[playerid][LoggedIn] = true;
- PlayerInfo[playerid][LoginAttempts] = 0;
- SendClientMessage( playerid, -1, "{6699CC}Thanks for logging in!");
- printf(" ... %s (id%d) logged in his account ...", GetName( playerid ), playerid );
- return 1;
- }
- else
- {
- SendClientMessage( playerid, -1, "{FF6347}Wrong password. Remember passwords are CaSe SeNsItIvE.");
- PlayerInfo[playerid][LoginAttempts] += 1;
- if ( PlayerInfo[playerid][LoginAttempts] == 5 )
- {
- SendClientMessage( playerid, -1, " You have been kicked for security reasons." );
- printf(" ... %s (id%d) was kicked for 5 failed login attempts ...", GetName( playerid ), playerid );
- Kick( playerid );
- }
- ShowPlayerDialog( playerid, LOGIN_DIALOG, DIALOG_STYLE_INPUT, "{6699CC}Dear Manhunt Member", "{FFFFFF}This account is registered. To log in, input the password in the field.", "Log In", "Quit" );
- return 1;
- }
- }
- else
- {
- Kick(playerid);
- }
- return 1;
- }
- case REGISTER2_DIALOG:
- {
- SendClientMessage( playerid, -1, "{66FF33} You have registered. Have fun!" );
- TogglePlayerSpectating( playerid, 0 );
- SetSpawnInfo( playerid, 0, PlayerInfo[playerid][Skin], 3.0, 3.0, 10.0, 360.0, 0, 0, 0, 0, 0, 0 );
- SpawnPlayer( playerid );
- return 1;
- }
- case SETTINGS_DIALOG:
- {
- if ( response )
- {
- switch( listitem )
- {
- case 0:
- {
- ShowPlayerDialog( playerid, SKIN_DIALOG, DIALOG_STYLE_INPUT, "{99FF99}Input a valid skin ID.", "{FFFFFF}To change your skin, input a valid skin ID (0-300)", "OK", "Go Back" );
- return 1;
- }
- case 1:
- {
- ShowPlayerDialog( playerid, LOCKACC_DIALOG, DIALOG_STYLE_MSGBOX, "{99FF99}Lock Account Confirmation.", "{FFFFFF}You are about to lock your account.\n{FF0000}This method can't be undone, and is permanent!\nWhatever is your reason, please think twice before locking your account.", "OK", "Cancel");
- return 1;
- }
- }
- }
- }
- case SKIN_DIALOG:
- {
- if ( IsValidSkin ( strval(inputtext) ) )
- {
- if ( response )
- {
- SendClientMessage( playerid, -1, "{00FF00}Skin changed.");
- SetPlayerSkin( playerid, strval(inputtext) );
- PlayerInfo[playerid][Skin] = strval(inputtext);
- ShowSettingsDialog( playerid );
- printf(" ... %s (id%d) changed skin to %d via account setting menu ...", GetName( playerid ), playerid, strval( inputtext ) );
- }
- else if ( ! response )
- {
- ShowSettingsDialog( playerid );
- }
- }
- else
- {
- ShowSettingsDialog( playerid );
- SendClientMessage( playerid, -1, "{FF0000}Invalid skin ID (below 0, above 300, or unfunctional.");
- }
- }
- case LOCKACC_DIALOG:
- {
- if ( response )
- {
- SendClientMessage(playerid, -1, "Account Locked.");
- PlayerInfo[playerid][Locked] = 1;
- printf(" ... sadly, %s (id%d) locked his account ...", GetName( playerid ), playerid );
- Kick(playerid);
- }
- else if ( !response )
- {
- ShowSettingsDialog( playerid );
- }
- }
- case HELP_DIALOG:
- {
- switch( listitem )
- {
- case 0:
- {
- if ( response )
- {
- ShowPlayerDialog( playerid, MSG_DIALOG, DIALOG_STYLE_MSGBOX, "{99FF99}Manhunt Commands", "Basic:{FFFFFF} /kill, /settings, /help, /admins, /report, /pm, /info", "OK", "");
- }
- }
- case 1:
- {
- if ( response )
- {
- ShowPlayerDialog( playerid, MSG_DIALOG, DIALOG_STYLE_MSGBOX, "{99FF99}Manhunt Concept", "{FFFFFF}The Manhunt is a gamemode where a random player is randomly chosen.\nThen, the other players must hunt him down.\nIn change, who hunts down the 'victim', may receive a reward (random money and score).\nBut also, he will become the new 'victim', so other players must hunt him down.\n\n{6699CC}Have fun playing Manhunt, and remember to respect everyone and follow the rules!", "I agree", "");
- }
- }
- case 2:
- {
- if ( response )
- {
- ShowSettingsDialog( playerid );
- }
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerText( playerid, text[] )
- {
- if ( IsManhuntVictim( playerid ) )
- {
- new szOutput[128];
- format( szOutput, 128, "{FF0000}Manhunt %s: {CC0000}%s", GetName( playerid ), text );
- SendClientMessageToAll( -1, szOutput );
- return 0;
- }
- return 1;
- }
- public OnPlayerStateChange(playerid,newstate,oldstate)
- {
- if ( newstate == 2 || newstate == 3 )
- {
- if ( IsAirVehicle ( GetPlayerVehicleID ( playerid ) ) )
- {
- if ( IsManhuntVictim ( playerid ) )
- {
- RemovePlayerFromVehicle( playerid );
- SendClientMessage(playerid, 0xC0C0C0FF, "You may not be in this vehicle at the moment.");
- }
- }
- }
- return 1;
- }
- // Stock functions
- stock GetRandomPlayer()
- {
- new yplayer[MAX_PLAYERS+1];
- for (new y = 0; y != MAX_PLAYERS; y ++)
- {
- if (IsPlayerConnected(y))
- {
- yplayer[0] ++;
- yplayer[yplayer[0]] = y;
- }
- }
- return yplayer[random(yplayer[0])+1];
- }
- stock IsManhuntVictim( playerid )
- {
- return ( ManhuntVictim == playerid ) ? 1 : 0;
- }
- stock Random( min, max )
- {
- return min + random ( ( max - min ) );
- }
- stock GetName( playerid )
- {
- new szName[24] = "";
- if ( IsPlayerConnected ( playerid ) )
- {
- GetPlayerName( playerid, szName, 24 );
- }
- return szName;
- }
- stock IsValidSkin(skinid)
- {
- #define MAX_BAD_SKINS 22
- new badSkins[MAX_BAD_SKINS] =
- {
- 3, 4, 5, 6, 8, 42, 65, 74, 86,
- 119, 149, 208, 265, 266, 267,
- 268, 269, 270, 271, 272, 273, 289
- };
- if (skinid < 0 || skinid > 299) return false;
- for (new i = 0; i < MAX_BAD_SKINS; i++)
- {
- if (skinid == badSkins[i]) return false;
- }
- #undef MAX_BAD_SKINS
- return 1;
- }
- stock ClearChat( bool:global, playerid = -1)
- {
- if ( global == true )
- {
- foreach(Player, i)
- {
- for( new g = 0; g < 30; g++ )
- {
- SendClientMessage( i, -1, " " );
- }
- }
- }
- else
- {
- for(new i = 0; i < 30; i ++ )
- {
- SendClientMessage( playerid, -1, " " );
- }
- }
- return 1;
- }
- // Functions below allow loading vehicles from an exterior file.
- stock TokenByDelimiter(const szString[], szReturnStr[], Delimiter, iStartIndex )
- {
- new x = 0;
- while( szString[iStartIndex] != EOS && szString[iStartIndex] != Delimiter ) {
- szReturnStr[x] = szString[iStartIndex];
- x++;
- iStartIndex++;
- }
- szReturnStr[x] = EOS;
- if( szString[iStartIndex] == EOS ) iStartIndex = (-1);
- return iStartIndex;
- }
- stock LoadStaticVehiclesFromFile(const FileName[])
- {
- new File:FileRoot;
- new FileLine[256];
- new VariableHatch[64];
- new Type;
- new Float:SpawnX;
- new Float:SpawnY;
- new Float:SpawnZ;
- new Float:SpawnRot;
- new Color1, Color2;
- new Index;
- new iLoadedVehicles;
- FileRoot = fopen(FileName,filemode:io_read);
- if(!FileRoot) return 0;
- iLoadedVehicles = 0;
- while(fread(FileRoot,FileLine,256) > 0)
- {
- Index = 0;
- // Read type
- Index = TokenByDelimiter(FileLine,VariableHatch,',',Index);
- if(Index == (-1)) continue;
- Type = strval(VariableHatch);
- if(Type < 400 || Type > 611) continue;
- // Read X, Y, Z, Rotation
- Index = TokenByDelimiter(FileLine,VariableHatch,',',Index+1);
- if(Index == (-1)) continue;
- SpawnX = floatstr(VariableHatch);
- Index = TokenByDelimiter(FileLine,VariableHatch,',',Index+1);
- if(Index == (-1)) continue;
- SpawnY = floatstr(VariableHatch);
- Index = TokenByDelimiter(FileLine,VariableHatch,',',Index+1);
- if(Index == (-1)) continue;
- SpawnZ = floatstr(VariableHatch);
- Index = TokenByDelimiter(FileLine,VariableHatch,',',Index+1);
- if(Index == (-1)) continue;
- SpawnRot = floatstr(VariableHatch);
- // Read Color1, Color2
- Index = TokenByDelimiter(FileLine,VariableHatch,',',Index+1);
- if(Index == (-1)) continue;
- Color1 = strval(VariableHatch);
- Index = TokenByDelimiter(FileLine,VariableHatch,';',Index+1);
- Color2 = strval(VariableHatch);
- //printf("%d,%d,%f,%f,%f,%f,%d,%d",total_vehicles_from_files+iLoadedVehicles+1,Type,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2);
- AddStaticVehicleEx(Type,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2,(30*60)); // respawn 30 minutes
- /*new numplate_test[32+1];
- format(numplate_test,32,"GRLC{44AA33}%d",vid);
- SetVehicleNumberPlate(vid, numplate_test);*/
- iLoadedVehicles++;
- }
- fclose(FileRoot);
- return iLoadedVehicles;
- }
- stock ShowSettingsDialog( playerid )
- {
- new Formatter[64];
- new Final[256];
- format( Formatter, 64, "{99FF99}Skin:\t {FFFFFF}%d\n", GetPlayerSkin( playerid ) );
- strcat( Final, Formatter, sizeof( Final ) );
- format( Formatter, 64, "%s", "{99FF99}Delete My Account" );
- strcat( Final, Formatter, sizeof( Final ) );
- ShowPlayerDialog( playerid, SETTINGS_DIALOG, DIALOG_STYLE_LIST, "{FFFFFF}Account Configuration Menu", Final, "Continue", "Close" );
- return 1;
- }
- stock IsAirVehicle( vehicleid )
- {
- new mod = GetVehicleModel(vehicleid);
- return bool:( mod == 592 || mod == 577 || mod == 511 || mod == 512 ||
- mod == 593 || mod == 520 || mod == 553 || mod == 476 ||
- mod == 519 || mod == 460 || mod == 513 || mod == 548 ||
- mod == 417 || mod == 487 || mod == 488 || mod == 497 ||
- mod == 563 || mod == 447 || mod == 469 ) ? true : false;
- }
- // Commands ZCMD
- CMD:kill( playerid, params[] )
- {
- SetPlayerHealth(playerid,0);
- return 1;
- }
- CMD:settings( playerid, params[] )
- {
- if ( PlayerInfo[playerid][LoggedIn] == false )
- {
- SendClientMessage( playerid, -1, " You have been kicked for security reasons." );
- Kick( playerid );
- return 1;
- }
- ShowSettingsDialog( playerid );
- return 1;
- }
- CMD:help( playerid, params[] )
- {
- ShowPlayerDialog( playerid, HELP_DIALOG, DIALOG_STYLE_LIST, "{99FF99}Help Menu", "{FFFFFF}Server Commands\nGame Concept\nAccount Setting Menu", "OK", "Close");
- return 1;
- }
- CMD:info( playerid, params[] )
- {
- if ( ManhuntVictim == -1 )
- {
- SendClientMessage( playerid, -1, "{FF6347}No manhunt in progress.");
- return 1;
- }
- else
- {
- new szFormat[128], DialogStr[182];
- format( szFormat, 128, "{99FF99}Manhunt Victim:{FFFFFF} %s(id:%d)\n", ManhuntVictimName, ManhuntVictim );
- strcat( DialogStr, szFormat, 182 );
- format( szFormat, 128, "{99FF99}Money Reward for killing %s:{FFFFFF} $%d\n", ManhuntVictimName, ManhuntReward[1] );
- strcat( DialogStr, szFormat, 182 );
- format( szFormat, 128, "{99FF99}Score Reward for killing %s:{FFFFFF} %d", ManhuntVictimName, ManhuntReward[0] );
- strcat( DialogStr, szFormat, 182 );
- ShowPlayerDialog( playerid, MSG_DIALOG, DIALOG_STYLE_MSGBOX, "{99FF99}General Manhunt Information", DialogStr, "OK", "");
- }
- return 1;
- }
- CMD:pm( playerid, params[] )
- {
- new Victim, Message[128];
- if ( sscanf ( params, "us[128]", Victim, Message ) )
- {
- return SendClientMessage( playerid, -1, "{c0c0c0}Syntax: /pm ");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement