Код:
#include <a_samp>
#include <zcmd>
new Float:RandomSpawns[][] =
{
{1249.7258, -2047.9263, 59.9209, 90.2055}, // Randomspawn
{1241.2084, -2057.6521, 60.0190, 94.9352}, // Randomspawn
{1241.0105, -2052.6873, 59.9975, 2.8144}, // Randomspawn
{718.4906, -1477.3024, 5.4688, 357.9947}, // Randomspawn
{722.3772, -1477.2856, 5.4688, 272.3814} // Randomspawn
};
new Float:RandomSpawnsh[][] =
{
{2798.2529,-2393.8613,13.9560,95.1813}, // Randomspawn
{2716.1025,-2455.4011,29.0599,269.9179}, // Randomspawn
{2734.8933,-2551.2141,13.6456,172.7898}, // Randomspawn
{2793.9622,-2464.3323,13.6322,275.9981} // Randomspawn
};
new Float:RandomSpawnsp[][] =
{
{142.6763,1875.4998,17.8434,269.5123}, // Randomspawn
{268.8007,1884.5270,-30.0938,182.0331}, // Randomspawn
{201.1935,1869.3553,13.1406,271.1146}, // Randomspawn
{211.0045,1933.2153,23.2422,177.1036} // Randomspawn
};
new Float:RandomSpawnsk[][] =
{
{353.9568,2030.7959,23.8673,4.9459},
{280.6848,1982.0070,25.2704,279.1610},
{320.0032,1811.4578,17.6406,8.0880},
{383.0732,1892.0850,17.6406,43.7254}
};
new InMINI[MAX_PLAYERS];
new InRPG[MAX_PLAYERS];
new InDM[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
InMINI[playerid] = 0; // Makes the player set as not in the Minigun DM (Prevents other player's from being bugged.)
InRPG[playerid] = 0;
InDM[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
InMINI[playerid] = 0; // Makes the player set as not in the Minigun DM (Prevents other player's from being bugged.)
InRPG[playerid] = 0;
InDM[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(InMINI[playerid] == 1)
{ // Determines that the player is in the Minigun DM. When he is killed, and /mdm = 1, he will be teleported back to the DM.
SetPlayerVirtualWorld(playerid, 2); // Virtual World = 10
new Random = random(sizeof(RandomSpawnsh));
SetPlayerPos(playerid, RandomSpawnsh[Random][0], RandomSpawnsh[Random][1], RandomSpawnsh[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawnsh[Random][3]);
ResetPlayerWeapons( playerid );
GivePlayerWeapon( playerid , 38 , 9999);
}
if(InRPG[playerid] == 1)
{
SetPlayerVirtualWorld(playerid, 3); // Virtual World = 10
new Random = random(sizeof(RandomSpawnsp));
SetPlayerPos(playerid, RandomSpawnsp[Random][0], RandomSpawnsp[Random][1], RandomSpawnsp[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawnsp[Random][3]);
ResetPlayerWeapons( playerid );
GivePlayerWeapon( playerid , 35 , 9999 );
}
if(InDM[playerid] == 1)
{
SetPlayerVirtualWorld(playerid, 4); // Virtual World = 10
new Random = random(sizeof(RandomSpawnsk));
SetPlayerPos(playerid, RandomSpawnsk[Random][0], RandomSpawnsk[Random][1], RandomSpawnsk[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawnsk[Random][3]);
ResetPlayerWeapons( playerid );
GivePlayerWeapon( playerid , 0 , 1 );
GivePlayerWeapon( playerid , 24 , 9999 );
GivePlayerWeapon( playerid , 26 , 9999 );
GivePlayerWeapon( playerid , 29 , 9999 );
GivePlayerWeapon( playerid , 34 , 9999 );
GivePlayerWeapon( playerid , 16 , 9999 );
GivePlayerWeapon( playerid , 35 , 9999 );
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_MINIGAMES)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
switch(listitem)
{
case 0:
{
if( CnR[ playerid ] != 0 ) return SendClientMessage( playerid , -1 , " {FF0000}Error: {FFFFFF}You're already {00FFFF}Cops {FFFFFF}'n' {FF0000}Robbers minigame !" );
ShowPlayerDialog( playerid , D_CnR , DIALOG_STYLE_LIST , "{00FFFF}Cops {FFFFFF}'n' {FF0000}Robers" , "{00FFFF}Cop's\n{FF0000}Robber's" , "Select" , "Exit" );
}
case 1:
{
if(InMINI[playerid] != 1)
{
new Random = random(sizeof(RandomSpawnsh));
SetPlayerPos(playerid, RandomSpawnsh[Random][0], RandomSpawnsh[Random][1], RandomSpawnsh[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawnsh[Random][3]);
InMINI[playerid] = 1;
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof(pName));
SendClientMessage(playerid,-1,"{00FF00}Gunakan /Leave Untuk Keluar MiniGames.");
format(string, sizeof(string), "%s Telah Bergabung Ke MINIGUN(/Minigames) ",pName);
SendClientMessageToAll(COLOR_YELLOW, string);
SetPlayerVirtualWorld( playerid, 2 );
ResetPlayerWeapons( playerid );
GivePlayerWeapon( playerid , 38 , 9999);
}
}
case 2:
{
if(InRPG[playerid] != 1)
{
new Random = random(sizeof(RandomSpawnsp));
SetPlayerPos(playerid, RandomSpawnsp[Random][0], RandomSpawnsp[Random][1], RandomSpawnsp[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawnsp[Random][3]);
InRPG[playerid] = 1;
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof(pName));
SendClientMessage(playerid,-1,"{00FF00}Gunakan /Leave Untuk Keluar MiniGames.");
format(string, sizeof(string), "%s Telah Bergabung Ke RPG(/Minigames) ",pName);
SendClientMessageToAll(COLOR_YELLOW, string);
SetPlayerVirtualWorld( playerid, 3 );
ResetPlayerWeapons( playerid );
GivePlayerWeapon( playerid , 35 , 9999 );
}
}
case 3:
{
if(InDM[playerid] != 1)
{
new Random = random(sizeof(RandomSpawnsk));
SetPlayerPos(playerid, RandomSpawnsk[Random][0], RandomSpawnsk[Random][1], RandomSpawnsk[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawnsk[Random][3]);
InDM[playerid] = 1;
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof(pName));
SendClientMessage(playerid,-1,"{00FF00}Gunakan /Leave Untuk Keluar MiniGames.");
format(string, sizeof(string), "%s Telah Bergabung Ke DeathMatch(/Minigames) ",pName);
SendClientMessageToAll(COLOR_YELLOW, string);
SetPlayerVirtualWorld( playerid, 4 );
ResetPlayerWeapons( playerid );
GivePlayerWeapon( playerid , 0 , 1 );
GivePlayerWeapon( playerid , 24 , 9999 );
GivePlayerWeapon( playerid , 26 , 9999 );
GivePlayerWeapon( playerid , 29 , 9999 );
GivePlayerWeapon( playerid , 34 , 9999 );
GivePlayerWeapon( playerid , 16 , 9999 );
GivePlayerWeapon( playerid , 35 , 9999 );
}
}
}
}
}
if(dialogid == DIALOG_MINIGAMES1)
{
if(response) // If they clicked 'Select' or double-clicked a weapon
{
// Give them the weapon
switch(listitem)
{
case 0:
{
if( CnR[ playerid ] == 0)
{
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof(pName));
if(CnR[playerid] != 0) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Tidak Di Dalam MIniGames(CNR)" );
SetPlayerVirtualWorld( playerid , 0 );
SetPlayerInterior( playerid , 0 );
Robber[ playerid ] = 0;
Cop[ playerid ] = 0;
CnR[ playerid ] = 0;
ResetPlayerWeapons( playerid );
format(string, sizeof(string), "%s Telah Keluar Dari Minigames CNR", pName);
SendClientMessageToAll(COLOR_YELLOW, string);
}
}
case 1:
{
if(InMINI[playerid] == 0)
{
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof(pName));
if(InMINI[playerid] != 0) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Tidak Di Dalam MiniGames(MINI)" );
InMINI[playerid] = 0;
SetPlayerVirtualWorld( playerid , 0 );
SetPlayerInterior( playerid , 0 );
ResetPlayerWeapons( playerid );
new Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
format(string, sizeof(string), "%s Telah Keluar Dari MINIGUN DeathMatch", pName);
SendClientMessageToAll(COLOR_YELLOW, string);
}
}
case 2:
{
if(InRPG[playerid] == 0)
{
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof(pName));
if(InRPG[playerid] != 0) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Tidak Di Dalam MiniGames(RPG)" );
InRPG[playerid] = 0;
SetPlayerVirtualWorld( playerid , 0 );
SetPlayerInterior( playerid , 0 );
ResetPlayerWeapons( playerid );
new Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
format(string, sizeof(string), "%s Telah Keluar Dari RPG DeathMatch", pName);
SendClientMessageToAll(COLOR_YELLOW, string);
}
}
case 3:
{
if(InDM[playerid] == 0)
{
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof(pName));
if(InDM[playerid] != 0) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Tidak Di Dalam MiniGames(DM)" );
InDM[playerid] = 0;
SetPlayerVirtualWorld( playerid , 0 );
SetPlayerInterior( playerid , 0 );
ResetPlayerWeapons( playerid );
new Random = random(sizeof(RandomSpawns));
SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
format(string, sizeof(string), "%s Telah Keluar Dari DeathMatch", pName);
SendClientMessageToAll(COLOR_YELLOW, string);
}
}
}
}
}
switch( dialogid )
{
case D_CnR:
{
if( !response )return 1;
switch( listitem )
{
case 0:
{
if( CnR[ playerid ] != 1 )
{
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof(pName));
SendClientMessage(playerid,-1,"{00FFFF}You entered at Cops.");
SendClientMessage(playerid,-1,"{00FF00}Gunakan /Leave Untuk Keluar MiniGames.");
format(string, sizeof(string), "%s Telah Bergabung Ke MINIGAMES CNR(TEAM Cops) ", pName, playerid);
SendClientMessageToAll(COLOR_YELLOW, string);
Cop[ playerid ] = 1;
CnR[ playerid ] = 1;
SetPlayerVirtualWorld( playerid, 1 );
SetPlayerPos( playerid , 1568.4161, -1692.2710, 5.8906 );
SetPlayerSkin( playerid , 280 );
SetPlayerColor( playerid , 0x00FFFFFF );
ResetPlayerWeapons( playerid );
GivePlayerWeapon( playerid , 24 , 100 );
GivePlayerWeapon( playerid , 26 , 100 );
GivePlayerWeapon( playerid , 3 , 1 );
GivePlayerWeapon( playerid , 31 , 500 );
}
}
case 1:
{
if( CnR[ playerid ] != 1 )
{
new pName[MAX_PLAYER_NAME],string[128];
GetPlayerName(playerid,pName,sizeof(pName));
SendClientMessage(playerid,-1,"{FF0000}You entered at Robber.");
SendClientMessage(playerid,-1,"{00FF00}Gunakan /Leave Untuk Keluar MiniGames.");
format(string, sizeof(string), "%s Telah Bergabung Ke MINIGAMES CNR(TEAM Robber) ", pName, playerid);
SendClientMessageToAll(COLOR_YELLOW, string);
Robber[ playerid ] = 1;
CnR[ playerid ] = 1;
SetPlayerVirtualWorld( playerid, 1 );
SetPlayerPos( playerid , 1125.6915, -2036.4381, 69.8808 );
SetPlayerSkin( playerid , 293 );
SetPlayerColor( playerid , 0xFF0000FF );
ResetPlayerWeapons( playerid );
GivePlayerWeapon( playerid , 24 , 100 );
GivePlayerWeapon( playerid , 26 , 100 );
GivePlayerWeapon( playerid , 4 , 1 );
GivePlayerWeapon( playerid , 30 , 500 );
}
}
}
}
}
return 1;
}
CMD:minigames(playerid,params[]){
#pragma unused params
if(InDM[playerid] == 1) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Telah Di Dalam MiniGames(DM)" );
if(InRPG[playerid] == 1) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Telah Di Dalam MiniGames(RPG)" );
if(InMINI[playerid] == 1) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Telah Di Dalam MiniGames(MINI)" );
if(CnR[playerid] == 1) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Telah Di Dalam MIniGames(CNR)" );
ShowPlayerDialog(playerid, DIALOG_MINIGAMES, DIALOG_STYLE_LIST, "{00FF00}MINIGAMES", "CNR\nMini\nRPG\nDM", "Select", "Cancel");
return 1;
}
//_______________________________________BUG_____________________________________________________
CMD:leave(playerid,params[]){
#pragma unused params
if( InDM[ playerid ] != 1 ) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Tidak Di Dalam MiniGames(DM)" );
if( InRPG[ playerid ] != 1 ) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Tidak Di Dalam MiniGames(RPG)" );
if( InMINI[ playerid ] != 1 ) return SendClientMessage( playerid , -1 , "{FF0000}[ERROR]{FFFFFF}Kamu Tidak Di Dalam MiniGames(MINI)" );
if( CnR[ playerid ] != 1 ) return SendClientMessage( playerid , -1 , " {FF0000}Error:{FFFFFF} You're not in {00FFFF}Cops {FFFFFF}'n' {FF0000}RobbersP{FFFFFF} minigame!" );
ShowPlayerDialog(playerid, DIALOG_MINIGAMES1, DIALOG_STYLE_LIST, "{00FF00}Leave MINIGAMES", "Leave CNR\nMINI\nRPG\nDM", "Select", "Cancel");
return 1;
}