rendered paste body//-------=====-------=====-----=================-----=====-------=====----------//-------=====-------=====-----=================------=====-----=====-----------//-------=====-------=====-----=====-------=====-------=====---=====------------//-------=====-------=====-----=====-------=====--------=====-=====-------------//-------=================-----=================----------=====-----------------//-------=================-----=================---------=====------------------//-------=====-------=====-----=====-------=====--------=====-------------------//-------=====-------=====-----=====-------=====-------=====--------------------//-------=====-------=====-----=====-------=====------=====---------------------//-------=====-------=====-----=====-------=====-----=====-------------by R@f ©-/*R@f : CréatorSyg : Hay tower créatorFullmetal : TesterKyeman : /specplayer commandSneaky! : score TextDrawAll the SA-MP team for creating this Multiplayer mod*/#include <a_samp>#include <core>#include <float>forward TimerMove ();forward TimerScore ();forward TimerFini (id, x, y, z);forward TDScore ();forward RespawnJoueur (playerid);forward TimerDeRespawn (playerid);forward HayAC ();forward Unfreeze (playerid);#define COLOR_GREY 0xAFAFAFAA#define COLOR_GREEN 0x33AA33AA#define PAILLE_X 4 #define PAILLE_Y 4 #define PAILLE_Z 30#define PAILLE_B 146#define PAILLE_R 4#define SPEED_FACTOR 3000.0#define ID_HAY_OBJECT 3374#define ID_ROCK_OBJECT 1305#define ADMIN_SPEC_TYPE_NONE 0#define ADMIN_SPEC_TYPE_PLAYER 1new gSpectateID[MAX_PLAYERS];new gSpectateType[MAX_PLAYERS];new Vitesse_xy;new Vitesse_z;new Centre_x;new Centre_y;new Matrice[PAILLE_X][PAILLE_Y][PAILLE_Z];new Bottes[PAILLE_B];new Rochers[PAILLE_B];new EnDeplacement[PAILLE_B];new BotteDuHaut;new HAC;new Text:Score[MAX_PLAYERS];new Text:Mort;main(){ print("\n-------------------------------------------"); print(" Hay GameMode for SA-MP 1.1 by R@f and Syg"); print("-------------------------------------------\n");}//==============================================================================public OnGameModeInit(){ SetGameModeText("Hay 1.1"); UsePlayerPedAnims(); InitialiserTourPaille (); SetTimer ("TimerScore", 200, 1); SetTimer ("TDScore", 600, 1); AddPlayerClass(0, 35.0, 6.5, 3.2, 135.1425, 0, 0, 0, 0, 0, 0); AddPlayerClass(29, 35.0, 6.5, 3.2, 135.1425, 0, 0, 0, 0, 0, 0); AddPlayerClass(188, 35.0, 6.5, 3.2, 135.1425, 0, 0, 0, 0, 0, 0); return 1;}//==============================================================================public OnPlayerRequestClass(playerid, classid){ SetPlayerPos(playerid, -8.6413,-8.4667,95.5060); SetPlayerFacingAngle(playerid,269.1425); SetPlayerCameraPos(playerid, -0.8600,-0.4655,97.1056); SetPlayerCameraLookAt(playerid, -8.6413,-8.4667,95.5060); ApplyAnimation(playerid,"DANCING","DNCE_M_A",4.0,1,0,0,0,-1); PlayerPlaySound(playerid,1062, 0.0, 0.0, 0.0); switch (classid) { case 0: { GameTextForPlayer(playerid, "~g~CJ", 1500, 3); } case 1: { GameTextForPlayer(playerid, "~w~Raf", 1500, 3); } case 2: { GameTextForPlayer(playerid, "~w~Syg", 1500, 3); } } return 1;}//==============================================================================public OnPlayerConnect(playerid){ new string[256], pname[250]; GetPlayerName(playerid, pname, sizeof(pname)); format(string, sizeof(string), "**** %s has joined the server ****", pname); SendClientMessageToAll(COLOR_GREY, string); format(string, sizeof(string), "Welcome %s on the hay server scripted by R@f and Syg ", pname); SendClientMessage(playerid,COLOR_GREY, string); SendClientMessage(playerid,COLOR_GREY, "if you want to see the commands, write /cmds"); GameTextForPlayer(playerid,"~w~]~b~H~r~A~g~Y~y~ 1.1~w~]",2500,5); SetPlayerColor(playerid, COLOR_GREY); return 1;}//==============================================================================public OnPlayerDisconnect(playerid, reason){ new pname[400], string[500]; GetPlayerName(playerid, pname, sizeof(pname)); if(reason == 0) { format(string, sizeof(string), "**** %s left the server. (Timeout) ****", pname); SendClientMessageToAll(COLOR_GREY, string); print(string); } else if(reason == 1) { format(string, sizeof(string), "**** %s left the server. (Leaving...) ****", pname); SendClientMessageToAll(COLOR_GREY, string); print(string); } else if(reason == 2) { format(string, sizeof(string), "**** %s left the server. (Kicked/Banned) ****", pname); SendClientMessageToAll(COLOR_GREY, string); print(string); } return 1;}//==============================================================================public OnPlayerDeath(playerid, killerid, reason){ SetTimerEx("TimerDeRespawn", 3725, 0, "i", playerid); SendDeathMessage(killerid,playerid,reason); TextDrawHideForPlayer(playerid, Score[playerid]); TextDrawDestroy(Score[playerid]); return 1;}//==============================================================================public OnPlayerSpawn(playerid){ Score[playerid] = TextDrawCreate(20.0,425.0," "); TextDrawAlignment(Score[playerid],0); TextDrawBackgroundColor(Score[playerid],0x000000ff); TextDrawFont(Score[playerid],1); TextDrawLetterSize(Score[playerid],0.5,1.5); TextDrawColor(Score[playerid],0xffffffcc); TextDrawSetOutline(Score[playerid],1); TextDrawSetProportional(Score[playerid],1); TextDrawSetShadow(Score[playerid],1); TextDrawShowForPlayer(playerid, Score[playerid]); PlayerPlaySound (playerid, 1063, 0.0, 0.0, 0.0); SetPlayerWorldBounds(playerid, 116.7788, -70.06725, 105.1009, -116.7788); return 1;}//==============================================================================public OnPlayerCommandText(playerid, cmdtext[]){ new cmd[256],specplayerid,idx,pid,PidName[MAX_PLAYER_NAME]; cmd = strtok(cmdtext, idx); if(IsPlayerAdmin(playerid)) { if(strcmp(cmdtext, "/acmds", true) == 0) { SendClientMessage(playerid,COLOR_GREEN,"***Hay GameMode for SA-MP***"); SendClientMessage(playerid,COLOR_GREEN,"/gmx : restart the GM"); SendClientMessage(playerid,COLOR_GREEN,"/hay : rebuild the hay tower"); SendClientMessage(playerid,COLOR_GREEN,"/acon : switch the Hay Anti-Cheat ON"); SendClientMessage(playerid,COLOR_GREEN,"/acoff : switch the Hay Anti-Cheat OFF"); return 1; } if(strcmp(cmdtext, "/gmx", true) == 0) { SendRconCommand("gmx"); return 1; } if(strcmp(cmdtext, "/hay", true) == 0) { NettoyerTourDePaille(); InitialiserTourPaille (); return 1; } if(strcmp(cmdtext, "/acon", true) == 0) { HAC = SetTimer("HayAC",1000,1); SendClientMessage(playerid,COLOR_GREEN,"HAC : Anti-cheat On"); print("HAC : Anti-cheat On"); return 1; } if(strcmp(cmdtext, "/acoff", true) == 0) { KillTimer(HAC); SendClientMessage(playerid,COLOR_GREEN,"HAC : Anti-cheat Off"); print("HAC : Anti-cheat Off"); return 1; } } if(strcmp(cmdtext, "/help", true) == 0) { SendClientMessage(playerid,COLOR_GREEN,"***Hay GameMode for SA-MP***"); SendClientMessage(playerid,COLOR_GREEN,"For a list of the commands write /cmds"); SendClientMessage(playerid,COLOR_GREEN,"For the list of the credits write /credits"); return 1; } // if(strcmp(cmdtext, "/cmds", true) == 0) { SendClientMessage(playerid,COLOR_GREEN,"***Hay GameMode for SA-MP***"); SendClientMessage(playerid,COLOR_GREEN,"/kill : Kill your self"); SendClientMessage(playerid,COLOR_GREEN,"/score : Look your score or an player score"); SendClientMessage(playerid,COLOR_GREEN,"/specplayer : Spec a player"); SendClientMessage(playerid,COLOR_GREEN,"/specoff : Turn the specplayer off"); SendClientMessage(playerid,COLOR_GREEN,"/cam : Show the hay tower"); SendClientMessage(playerid,COLOR_GREEN,"/spawn : Spawn at your spawn point"); SendClientMessage(playerid,COLOR_GREEN,"/acmds : See admin commands (Admin Only)"); return 1; } // if(strcmp(cmdtext, "/credits", true) == 0) { SendClientMessage(playerid,COLOR_GREEN,"***Hay GameMode for SA-MP***"); SendClientMessage(playerid,COLOR_GREEN,"This GameMode is scripted by R@f and Syg"); SendClientMessage(playerid,COLOR_GREEN,"Special thanks to Syg for the hay script"); SendClientMessage(playerid,COLOR_GREEN,"Thanks to Kyeman for his Specplayer"); SendClientMessage(playerid,COLOR_GREEN,"And Sneaky! for the score TextDraw"); return 1; } // if(strcmp(cmdtext, "/kill", true) == 0) { SetPlayerHealth(playerid,-9999); return 1; } // if(strcmp(cmdtext, "/spawn", true) == 0) { SpawnPlayer(playerid); return 1; } // if(strcmp(cmdtext, "/cam", true) == 0) { TogglePlayerControllable(playerid,0); SetPlayerCameraPos(playerid, 32.9946,47.2079,78.5389); SetPlayerCameraLookAt(playerid, -5.6487,1.4449,50.5060); SendClientMessage(playerid,COLOR_GREEN,"Write /spawn to exit this view"); return 1; } // if(strcmp(cmd, "/score", true) == 0) { new tmp[256],PidScore; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREEN, "USAGE: /score [playerid]"); return 1; } pid = strval(tmp); if(!IsPlayerConnected(pid)) { SendClientMessage(playerid, COLOR_GREY, "[ERROR] that player isn't active."); return 1; } PidScore = GetPlayerScore(pid); GetPlayerName(pid, PidName, sizeof(PidName)); format(tmp, sizeof(tmp),"%s(ID:%d) level is : %d",PidName,pid,PidScore); SendClientMessage(playerid,COLOR_GREEN,tmp); return 1; } // if(strcmp(cmd, "/specplayer", true) == 0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREEN, "USAGE: /specplayer [playerid]"); return 1; } specplayerid = strval(tmp); if(!IsPlayerConnected(specplayerid)) { SendClientMessage(playerid, COLOR_GREY, "[ERROR] that player isn't active."); return 1; } TogglePlayerSpectating(playerid, 1); SetPlayerInterior(playerid,GetPlayerInterior(specplayerid)); gSpectateID[playerid] = specplayerid; gSpectateType[playerid] = ADMIN_SPEC_TYPE_PLAYER; return 1; } // if(strcmp(cmd, "/specoff", true) == 0) { TogglePlayerSpectating(playerid, 0); gSpectateID[playerid] = INVALID_PLAYER_ID; gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE; return 1; } return 0;}//==============================================================================InitialiserTourPaille (){ new x, y, z; new Compte; Vitesse_xy = 2000 / (PAILLE_Z + 1); Vitesse_z = 1500 / (PAILLE_Z + 1); for (new i=0 ; i<MAX_PLAYERS ; i++) { if (IsPlayerConnected (i)) { SetPlayerScore (i, 0); } } for (x=0 ; x<PAILLE_X ; x++) { for (y=0 ; y<PAILLE_Y ; y++) { for (z=0 ; z<PAILLE_Z ; z++) { Matrice[x][y][z] = 0; } } } for (Compte=0 ; Compte<PAILLE_B ; Compte++) { do { x = random (PAILLE_X); y = random (PAILLE_Y); z = random (PAILLE_Z); } while (Matrice[x][y][z] != 0); Matrice[x][y][z] = 1; Bottes[Compte] = CreateObject (ID_HAY_OBJECT, x*(-4), y*(-4), (z+1)*3, 0.0, 0.0, random (2)*180); } for (Compte=0 ; Compte<PAILLE_R ; Compte++) { do { x = random (PAILLE_X); y = random (PAILLE_Y); z = random (PAILLE_Z); } while (Matrice[x][y][z] != 0); Matrice[x][y][z] = 1; Rochers[Compte] = CreateObject (ID_ROCK_OBJECT, x*-4, y*-4, (z+1)*3, random (360), random (360), random (360)); } Centre_x = (PAILLE_X + 1) * -2; Centre_y = (PAILLE_Y + 1) * -2; BotteDuHaut = CreateObject (ID_HAY_OBJECT, Centre_x, Centre_y, PAILLE_Z*3 + 3, 0, 0, 0); SetTimer ("TimerMove", 100, 0);}//==============================================================================NettoyerTourDePaille (){ for (new i=0 ; i<PAILLE_B ; i++) { DestroyObject (Bottes[i]); } DestroyObject (BotteDuHaut); for (new i=0 ; i<PAILLE_R ; i++) { DestroyObject (Rochers[i]); }}//==============================================================================public TimerMove (){ new rand; new Botte; new Move; new x, y, z; new Float:x2, Float:y2, Float:z2; new Temps; new Float:Speed; do { rand = random (PAILLE_B); } while (EnDeplacement[rand] == 1); Botte = Bottes[rand]; Move = random (6); GetObjectPos (Botte, x2, y2, z2); x = floatround (x2/-4.0); y = floatround (y2/-4.0); z = floatround (z2/3.0)-1; if ((Move == 0) && (x != 0) && (Matrice[x-1][y][z] == 0)) { EnDeplacement[rand] = 1; Temps = 4000 - Vitesse_xy * z; Speed = SPEED_FACTOR / float (Temps); SetTimerEx ("TimerFini", Temps, 0, "iiii", rand, x, y, z); x = x - 1; Matrice[x][y][z] = 1; MoveObject (Botte, x2+4.0, y2, z2, Speed); } else if ((Move == 1) && (x != PAILLE_X-1) && (Matrice[x+1][y][z] == 0)) { EnDeplacement[rand] = 1; Temps = 4000 - Vitesse_xy * z; Speed = SPEED_FACTOR / float (Temps); SetTimerEx ("TimerFini", Temps, 0, "iiii", rand, x, y, z); x = x + 1; Matrice[x][y][z] = 1; MoveObject (Botte, x2-4.0, y2, z2, Speed); } else if ((Move == 2) && (y != 0) && (Matrice[x][y-1][z] == 0)) { EnDeplacement[rand] = 1; Temps = 4000 - Vitesse_xy * z; Speed = SPEED_FACTOR / float (Temps); SetTimerEx ("TimerFini", Temps, 0, "iiii", rand, x, y, z); y = y - 1; Matrice[x][y][z] = 1; MoveObject (Botte, x2, y2+4.0, z2, Speed); } else if ((Move == 3) && (y != PAILLE_Y-1) && (Matrice[x][y+1][z] == 0)) { EnDeplacement[rand] = 1; Temps = 4000 - Vitesse_xy * z; Speed = SPEED_FACTOR / float (Temps); SetTimerEx ("TimerFini", Temps, 0, "iiii", rand, x, y, z); y = y + 1; Matrice[x][y][z] = 1; MoveObject (Botte, x2, y2-4.0, z2, Speed); } else if ((Move == 4) && (z != 0) && (Matrice[x][y][z-1] == 0)) { EnDeplacement[rand] = 1; Temps = 3000 - Vitesse_z * z; Speed = SPEED_FACTOR / float (Temps); SetTimerEx ("TimerFini", Temps, 0, "iiii", rand, x, y, z); z = z - 1; Matrice[x][y][z] = 1; MoveObject (Botte, x2, y2, z2-3.0, Speed); } else if ((Move == 5) && (z != PAILLE_Z-1) && (Matrice[x][y][z+1] == 0)) { EnDeplacement[rand] = 1; Temps = 3000 - Vitesse_z * z; Speed = SPEED_FACTOR / float (Temps); SetTimerEx ("TimerFini", Temps, 0, "iiii", rand, x, y, z); z = z + 1; Matrice[x][y][z] = 1; MoveObject (Botte, x2, y2, z2+3.0, Speed); } SetTimer ("TimerMove", 100, 0);}//==============================================================================public TimerFini (id, x, y, z){ EnDeplacement[id] = 0; Matrice[x][y][z] = 0;}//==============================================================================public TimerScore (){ new Float:x, Float:y, Float:z; for (new i=0 ; i<MAX_PLAYERS ; i++) { if (IsPlayerConnected (i)) { GetPlayerPos (i, x, y, z); if (x<=2.0 && x>=-15.0 && y<=2.0 && y>=-15.0) { new Level = (floatround (z)/3) - 1; SetPlayerScore (i, Level); } else { SetPlayerScore (i, 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 TDScore(){ new Level; new string[128]; new PlayerName[MAX_PLAYER_NAME]; for (new i=0 ; i<MAX_PLAYERS ; i++) { if(IsPlayerConnected(i)) { Level = GetPlayerScore(i); format(string,sizeof(string),"YOUR LEVEL: %d",Level); TextDrawSetString(Score[i], string); } if(GetPlayerScore(i) == 100) { GetPlayerName(i, PlayerName, sizeof(PlayerName)); format(string, sizeof(string),"]]]]]~n~%s is at the top of the hay tower~n~]]]]]", PlayerName); GameTextForAll(string,2500,4); } }}//==============================================================================EcranMort(playerid){TogglePlayerControllable(playerid,0);SetPlayerCameraPos(playerid, 32.9946,47.2079,78.5389);SetPlayerCameraLookAt(playerid, -5.6487,1.4449,50.5060);SendClientMessage(playerid,COLOR_GREEN,"you will respawn in 10 seconds");SetTimerEx("RespawnJoueur",10000,0,"i",playerid);Mort = TextDrawCreate(320.00, 240.00, "~r~You are death");TextDrawSetOutline(Mort, 0);TextDrawFont(Mort, 3);TextDrawSetProportional(Mort, 2);TextDrawAlignment(Mort, 2);TextDrawLetterSize(Mort,2,2);TextDrawShowForPlayer (playerid, Mort);}//==============================================================================public RespawnJoueur(playerid){TogglePlayerControllable(playerid,1);SetCameraBehindPlayer(playerid);SendClientMessage(playerid,COLOR_GREEN,"You are respawned, next time try to be alive ;)");TextDrawHideForPlayer (playerid, Mort);}//==============================================================================public TimerDeRespawn (playerid){ EcranMort(playerid);}//==============================================================================public HayAC (){ new Float:health,Float:armour,string[256],PlayerName[MAX_PLAYER_NAME]; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { //if (!IsPlayerAdmin(i)) //{ if(GetPlayerHealth(i,health) > 101) { GetPlayerName(i, PlayerName, sizeof(PlayerName)); format(string, sizeof(string),"HAC: %s (ID:%d) has been kicked from the server (Reason : Health Hack)", PlayerName,i); SendClientMessageToAll(COLOR_GREY,string); print(string); Kick(i); } else if(GetPlayerWeapon(i) > 2) { GetPlayerName(i, PlayerName, sizeof(PlayerName)); format(string, sizeof(string),"HAC: %s (ID:%d) has been kicked from the server (Reason : Weapons hack)", PlayerName,i); SendClientMessageToAll(COLOR_GREY,string); print(string); Kick(i); } else if(GetPlayerScore(i) > 32) { GetPlayerName(i, PlayerName, sizeof(PlayerName)); format(string, sizeof(string),"HAC: %s (ID:%d) has been kicked from the server (Reason : Invaild Score)", PlayerName,i); SendClientMessageToAll(COLOR_GREY,string); print(string); Kick(i); } else if(GetPlayerArmour(i,armour) > 1) { GetPlayerName(i, PlayerName, sizeof(PlayerName)); format(string, sizeof(string),"HAC: %s (ID:%d) has been kicked from the server (Reason : Armour hack)", PlayerName,i); SendClientMessageToAll(COLOR_GREY,string); print(string); Kick(i); } else if(GetPlayerMoney(i) > 1) { GetPlayerName(i, PlayerName, sizeof(PlayerName)); format(string, sizeof(string),"HAC: %s (ID:%d) has been kicked from the server (Reason : Money hack)", PlayerName,i); SendClientMessageToAll(COLOR_GREY,string); print(string); Kick(i); } //} } }}//==============================================================================public OnRconCommand(cmd[]){ if (!strcmp(cmd,"hacon")) { HAC = SetTimer("HayAC",1000,1); print("HAC : Anti-cheat On"); return 1; } if (!strcmp(cmd,"hacoff")) { KillTimer(HAC); print("HAC : Anti-cheat Off"); return 1; } return 0;}//==============================================================================public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){ if ((newkeys & KEY_FIRE)) { if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { TogglePlayerControllable(playerid,0); SetTimerEx("Unfreeze",1,0,"i",playerid); } }}//==============================================================================public Unfreeze(playerid){TogglePlayerControllable(playerid,1);}//==============================================================================//==============================================================================//==============================================================================