rendered paste body// Crack Palace Deathmatch GM 0.1
// Coded by Chiarboss
// ©2007
// Dont edit code or part of it without my permission
// To get permission contact: marco.chiarelli@hotmail.it
#include <a_samp>
#pragma tabsize 0
//colori
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_BLUE 0x1111AAFF
#define COLOR_PINK 0xFF66FFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
enum PlayerSpawnInfo {
Float:PlayerX,
Float:PlayerY,
Float:PlayerZ,
Float:PlayerAngle
}
new playerColors[100] = {
0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF,
0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,
0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,
0x275222FF,0xF09F5BFF,0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,
0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,0x4B8987FF,
0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,
0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,
0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,
0x9F945CFF,0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,0xD8C762FF,
0x3FE65CFF
};
new Float:gRandomSpawns[][PlayerSpawnInfo] =
{
{2543.340087,-1308.362915,1026.717163,181.574005},
{2527.9026,-1290.1290,1031.4219,183.3510},
{2571.4099,-1286.6647,1031.4219,182.0976},
{2538.8955,-1293.5408,1044.1250,271.0617},
{2521.1069,-1281.8789,1054.6406,174.8441},
{2547.2249,-1288.8175,1054.6406,171.3974},
{2579.7998,-1284.3066,1065.3596,91.1833},
{-1385.9572,373.9840,7.1875,177.2937}
};
//-------------------------------------------------------------------------
new consecutive[MAX_PLAYERS];
new st;
new inshop[MAX_PLAYERS];
new remove;
new HighestScore;
new HighestScorers[MAX_PLAYERS];
new gRoundUpdate0 = 300000;
new gRoundUpdate1 = 900000;
//-------------------------------------------------------------------------
forward CheckScore();
forward GameModeExitFunc();
forward ExitShop(playerid);
forward Update0();
forward Update1();
//-------------------------------------------------------------------------
main()
{
print("\nLoaded Crack Palace Deathmatch GM 0.1\n");
}
//-------------------------------------------------------------------------
public OnGameModeInit()
{
SetTimer("CheckScore", 1200000, 0); // 20 minutes
SetTimer("Update0",gRoundUpdate0,0);
SetTimer("Update1",gRoundUpdate1,0);
st = 0;
SetGameModeText("Crack Palace Deathmatch GM 0.1");
ShowPlayerMarkers(0);
ShowNameTags(1);
AddPlayerClass(0,2543.340087,-1308.362915,1026.717163,181.574005,24,700,25,100,29,700); // spawn
AddPlayerClass(103,2527.9026,-1290.1290,1031.4219,183.3510,24,700,25,100,30,3000); // spawn1
AddPlayerClass(102,2571.4099,-1286.6647,1031.4219,182.0976,24,700,29,700,4,1); // spawn2
AddPlayerClass(115,2538.8955,-1293.5408,1044.1250,271.0617,24,700,29,700,5,1); // spawn3
AddPlayerClass(114,2521.1069,-1281.8789,1054.6406,174.8441,23,3000,31,3000,25,100); // spawn4
AddPlayerClass(1,2547.2249,-1288.8175,1054.6406,171.3974,24,700,29,700,4,1); // spawn5
AddPlayerClass(23,2579.7998,-1284.3066,1065.3596,91.1833,24,700,29,700,6,1); // spawn6
AddStaticVehicle(590,2543.284912,-1305.198974,1025.070312,272.988525,52,52);
AddStaticVehicle(601,2561.978271,-1284.004272,1031.180664,355.683471,53,2);
LinkVehicleToInterior(1,2);
LinkVehicleToInterior(2,2);
AddStaticPickup(1240, 2, 2550.09,-1297.159,1060.984);
AddStaticPickup(1240, 2, 2526.385,-1285.134,1048.289);
AddStaticPickup(1240, 2, 2575.61,-1286.737,1037.773);
AddStaticPickup(356, 2, 2561.171,-1302.578,1054.641);
SetWorldTime(0);
AllowInteriorWeapons(1);
return 1;
}
//-------------------------------------------------------------------------
public Update0()
{
GameTextForAll("~n~~n~Time Remaining: ~w~15 minutes!", 3000, 3);
return 1;
}
//-------------------------------------------------------------------------
public Update1()
{
GameTextForAll("~n~~r~Time Remaining: ~w~5 minutes!", 3000, 3);
return 1;
}
//-------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, 0xFF8A00AA, "Welcome to Crack Palace Deathmatch GM 0.1 [coded by Chiarboss]");
SendClientMessage(playerid, 0xFFFFFFAA, "Type /about if you don't now how this mode work");
SendClientMessage(playerid, 0xFFFF00AA, "Type /help for knowing the rules of GM");
GameTextForPlayer(playerid, "~g~- ~r~Crack Palace ~y~Deathmatch ~g~-", 6000, 1);
SendClientMessage(playerid,COLOR_RED,"Choice a character!");
GivePlayerMoney(playerid, 1000);
SetPlayerColor(playerid, COLOR_GREY); // Set the player's color to inactive
inshop[playerid] = 0;
return 1;
}
//-------------------------------------------------------------------------
public OnPlayerText(playerid)
{
printf("OnPlayerText(%d)", playerid);
return 1;
}
//-------------------------------------------------------------------------
public OnPlayerInfoChange(playerid)
{
printf("OnPlayerInfoChange(%d)");
return 1;
}
//-------------------------------------------------------------------------
public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid,2);
SetPlayerColor(playerid,playerColors[playerid]);
PlayerPlaySound(playerid, 1098, 0, 0, 0);
consecutive[playerid] = 0;
SetPlayerCheckpoint(playerid,2561.5405,-1285.4424,1054.6406,2.5);
GameTextForPlayer(playerid,"~n~~n~~r~Search ~w~the players and ~r~kill ~w~them!!!", 5000, 3);
return 1;
}
//-------------------------------------------------------------------------
public OnPlayerDeath(playerid, killerid, reason)
{
new string[256];
new name[MAX_PLAYER_NAME];
ResetSpawnInfo(playerid);
if(killerid == INVALID_PLAYER_ID)
{
SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
}
else
{
st++;
GetPlayerName(killerid,name, sizeof(name));
GivePlayerMoney(killerid, 1000);
SendDeathMessage(killerid, playerid, reason);
consecutive[killerid]++;
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
if(st == 1)
{
format(string, sizeof(string), "%s made the first kill! +3 kills to him!",name);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 2);
SendClientMessageToAll(COLOR_YELLOW,string);
}
if(consecutive[killerid] == 5)
{
format(string, sizeof(string), "%s is rockin' out!",name);
SendClientMessageToAll(COLOR_YELLOW,string);
}
else if(consecutive[killerid] == 6)
{
format(string, sizeof(string), "OMG! %s is pwning you all!",name);
SendClientMessageToAll(COLOR_YELLOW,string);
}
else if(consecutive[killerid] == 7)
{
format(string, sizeof(string), "WOW! %s ~w~is an omicide fury!",name);
SendClientMessageToAll(COLOR_YELLOW,string);
}
else if(consecutive[killerid] >= 8)
{
format(string, sizeof(string), "%s: the king of the server... 0.0",name);
SendClientMessageToAll(COLOR_YELLOW,string);
}
GameTextForPlayer(playerid, "~n~~y~Wasted!", 1000, 3);
GameTextForPlayer(killerid, "~n~~y~Good shot!", 1000, 3);
}
return 1;
}
//-------------------------------------------------------------------------
ResetSpawnInfo(playerid) {
new randSPAWN=random(sizeof(gRandomSpawns));
SetPlayerPos(playerid,gRandomSpawns[randSPAWN][PlayerX],gRandomSpawns[randSPAWN][PlayerY],gRandomSpawns[randSPAWN][PlayerZ]);
SetPlayerFacingAngle(playerid,gRandomSpawns[randSPAWN][PlayerAngle]);
}
//-------------------------------------------------------------------------
stock SetupPlayerForClassSelection(playerid)
{
PlayerPlaySound(playerid, 1097, 0, 0, 0);
SetPlayerPos(playerid,2521.3723,-1272.7750,34.8932);
SetPlayerFacingAngle(playerid,88.8214);
SetPlayerCameraPos(playerid,2518.5557,-1272.7352,34.8751);
SetPlayerCameraLookAt(playerid,2518.5557,-1272.7352,34.8751);
return;
}
//-------------------------------------------------------------------------
public OnPlayerRequestClass(playerid, classid)
{
printf("OnPlayerRequestClass(%d, %d)", playerid, classid);
SetupPlayerForClassSelection(playerid);
return 1;
}
//-------------------------------------------------------------------------
public OnPlayerEnterCheckpoint(playerid)
{
new name[MAX_PLAYER_NAME];
new string[256];
remove = SetTimer("ExitShop", 30000, 0);
TogglePlayerControllable(playerid,0);
inshop[playerid] ++;
GetPlayerName(playerid,name, sizeof(name));
format(string, sizeof(string), "- Welcome to Crack Arsenal, %s; -",name);
SendClientMessage(playerid, 0xFF8A00AA, string);
SendClientMessage(playerid, 0xFF8A00AA, "Here you can buy:");
SendClientMessage(playerid, 0xFF8A00AA, "----------------------------------");
SendClientMessage(playerid, 0xFF8A00AA, "/100hp [1000$]");
SendClientMessage(playerid, 0xFF8A00AA, "/sawnoff [2000$]");
SendClientMessage(playerid, 0xFF8A00AA, "/exit");
SendClientMessage(playerid, 0xFF8A00AA, "----------------------------------");
GameTextForPlayer(playerid, "~n~~r~P.S.: ~w~if you dont ~r~exit ~w~the shop in 30 second ~r~you will be removed.",3000,3);
return 1;
}
//-------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/help", true) == 0)
{
SendClientMessage(playerid,0xFFFF00AA,"This is a simply DM in Big Smoke's Crack Palace");
SendClientMessage(playerid,0xFFFF00AA,"The objective is only that one scovare the other players and kill them.");
SendClientMessage(playerid,0xFFFF00AA,"At the end of timer, wins who have more points");
SendClientMessage(playerid,0xFFFF00AA,"Type /cmdlist for knowing the list of Commands...");
return 1;
}
if(strcmp(cmd, "/about", true) == 0)
{
SendClientMessage(playerid,0xFFFFFFAA,"Crack Palace Deathmatch GM 0.1");
SendClientMessage(playerid,0xFFFFFFAA,"This gamemode was created by Chiarboss;");
SendClientMessage(playerid,0xFFFFFFAA,"Do NOT copy this gamemode code or part of it.");
return 1;
}
if(strcmp(cmd, "/cmdlist", true)==0){
SendClientMessage(playerid,0xFFFF00AA,"/cmdlist ;");
SendClientMessage(playerid,0xFFFF00AA,"/help ;");
SendClientMessage(playerid,0xFFFF00AA,"/about ;");
SendClientMessage(playerid,0xFFFF00AA,"/shophelp ;");
return 1;
}
if(strcmp(cmd, "/shophelp", true)==0){
SendClientMessage(playerid,0xFFFF00AA,"If you are in the red checkpoint at the secret room in the Ballas Saloon,");
SendClientMessage(playerid,0xFFFF00AA,"press /100hp for recharge your hpbar for 1000$;");
SendClientMessage(playerid,0xFFFF00AA,"press /sawnoff for buy a Sawn Off Shotgun for 2000$;");
SendClientMessage(playerid,0xFFFF00AA,"press /exit for exit from the shop...");
SendClientMessage(playerid,0xFFFF00AA,"...if you dont exit the shop in 30 second you will be removed.");
return 1;
}
if(strcmp(cmd, "/100hp", true) == 0)
{
if(inshop[playerid] == 1)
{
if(GetPlayerMoney(playerid) >= 1000)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name, sizeof(name));
format(string, sizeof(string), "- %s recharged his healtbar for 1000$. -",name);
SetPlayerHealth(playerid, 100);
SendClientMessageToAll(0xFF8A00AA,string);
TogglePlayerControllable(playerid,1);
SetPlayerPos(playerid,2559.2009,-1285.5802,1054.6406);
GivePlayerMoney(playerid, -1000);
inshop[playerid] = 0;
KillTimer(remove);
}
else
{
SendClientMessage(playerid, 0xFF8A00AA, "You dont have enough money! Kill to earn and come back!.");
}
return 1;
}
}
if(strcmp(cmd, "/sawnoff", true) == 0)
{
if(inshop[playerid] == 1){
if(GetPlayerMoney(playerid) >= 2000)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name, sizeof(name));
format(string, sizeof(string), "- %s bought a Sawn Off Shotgun for 2000$. -",name);
GivePlayerWeapon(playerid, 26, 90);
SendClientMessageToAll(0xFF8A00AA,string);
TogglePlayerControllable(playerid,1);
SetPlayerPos(playerid,2559.2009,-1285.5802,1054.6406);
GivePlayerMoney(playerid, -2000);
inshop[playerid] = 0;
KillTimer(remove);
}
else
{
SendClientMessage(playerid, 0xFF8A00AA, "You dont have enough money! Kill to earn and come back!.");
}
return 1;
}
}
if(strcmp(cmd, "/exit", true) == 0)
{
if(inshop[playerid] == 1){
SetPlayerPos(playerid,2559.2009,-1285.5802,1054.6406);
TogglePlayerControllable(playerid,1);
inshop[playerid] = 0;
KillTimer(remove);
return 1;
}
}
return 0;
}
//-------------------------------------------------------------------------
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
//-------------------------------------------------------------------------
public ExitShop(playerid)
{
SendClientMessage(playerid, 0xFF8A00AA, "You got removed from shop! Dont use the shop like a n00b!");
SetPlayerPos(playerid,2559.2009,-1285.5802,1054.6406);
TogglePlayerControllable(playerid,1);
inshop[playerid] = 0;
}
//-------------------------------------------------------------------------
stock CheckPlayerScore(){
new score;
new numberscorers;
for (new playerid = 0; playerid<MAX_PLAYERS; playerid++){
if(IsPlayerConnected(playerid)){
score=GetPlayerScore(playerid);
if(score > HighestScore){
for (new i=0; i<MAX_PLAYERS; i++){
HighestScorers[i] = 0;
}
HighestScorers[0]=playerid;
HighestScore=score;
numberscorers=1;
score=0;
} else {
if(score == HighestScore && HighestScore > 0){
HighestScorers[numberscorers]=playerid;
numberscorers++;
}
score=0;
}
}
}
return numberscorers;
}
//-------------------------------------------------------------------------
//In the routine where you make the call for the highest score:
public CheckScore(){
new numberscorers=CheckPlayerScore(); //not sure if the () should be attached
new giveplayername[MAX_PLAYER_NAME];
new string[256];
for (new i=0; i<MAX_PLAYERS; i++) {
if (IsPlayerConnected(i)) {
TogglePlayerControllable(i,0);
}
}
SetTimer("GameModeExitFunc",5000,0);
if(numberscorers > 0){
for (new i=0; i<numberscorers; i++){
GetPlayerName(HighestScorers[i], giveplayername, sizeof(giveplayername));
format(string, sizeof(string), "~r~%s ~n~~w~is the WINNER!!!", giveplayername);
GameTextForAll(string,5000,6);
}
} else {
GameTextForAll("~y~Nothing player have scored...",5000,6);
}
}
//-------------------------------------------------------------------------
public GameModeExitFunc() {
for (new i=0; i<MAX_PLAYERS; i++) {
if (IsPlayerConnected(i)) {
SendClientMessage(i,0xFF8A00AA,"Thanks for have played at Crack Palace Deathmatch GM 0.1");
}
}
GameModeExit(); }