//------------------------------------------------------------------------------ // // LOS SANTOS TEAM Deathmatch for SA-MP 0.1 // //------------------------------------------------------------------------------ #include "a_samp" #include "dini" #include #include #define settings "settings.ini" #define spawned PLAYER_STATE_SPAWNED #define foot PLAYER_STATE_ONFOOT #define vehicle PLAYER_STATE_DRIVER #define COLOR_GREY 0xAFAFAFAA #define COLOR_RED 0xAA3333AA #define COLOR_YELLOW 0xFFFF00AA #define COLOR_WHITE 0xFFFFFFAA #define PocketMoney 500 // Amount player recieves on spawn. #define INACTIVE_PLAYER_ID 255 #define GIVECASH_DELAY 5000 // Time in ms between /givecash commands. #define NUMVALUES 4 forward MoneyGrubScoreUpdate(); forward Givecashdelaytimer(playerid); //forward GrubModeReset(); forward SetPlayerRandomSpawn(playerid); forward SetupPlayerForClassSelection(playerid); forward GameModeExitFunc(); new speed; new hp; new clear; new stick; new c1; enum AC { SP, HP } new A1C[AC]; enum T { H, S, ST } new r[MAX_PLAYERS][T]; enum SavePlayerPosEnum { Float:LastX, Float:LastY, Float:LastZ } new SavePlayerPos[MAX_PLAYERS][SavePlayerPosEnum]; new mph[MAX_PLAYERS]; new bWeapons[5][1] = { {34}, {35}, {36}, {19}, {20} }; new chat[MAX_PLAYERS]; public OnFilterScriptInit() { print("\n..:: [:] [:] [:] [:] [:] [:] [:] [:] ::.."); print("..:: [:] xReaper - Anti!Cheat [:] ::.."); print("..:: [:] [:] [:] [:] [:] [:] [:] [:] ::..\n"); return 1; } public OnPlayerConnect(playerid) { if(A1C[SP] == 0) { speed = SetTimer("Hp",1000,1); hp = SetTimer("Speed",1160,1); clear = SetTimer("Clear",15000,1); stick = SetTimer("Stick",1000,1); c1 = SetTimer("cClear",4800,1); } return 1; } public OnPlayerDisconnect(playerid) { new p = GetConnectedPlayers(); if(p == 0) { KillTimer(speed); KillTimer(hp); KillTimer(clear); KillTimer(stick); KillTimer(c1); A1C[SP] = 0; } return 1; } public OnPlayerDeath(playerid,killerid,reason) { new str[130],player[24],killer[24],Float:x,Float:y,Float:z; if(killerid != INVALID_PLAYER_ID) { GetPlayerPos(killerid,x,y,z); GetPlayerName(playerid,killer,24); } GetPlayerName(playerid,player,24); for(new s=0; s<5; s++) if(reason == bWeapons[s][0]) { format(str,sizeof(str),"..:: xReaperx - Player %s has been [Possibly] detected |Fake Kill| ::..",player); Report(str); } if(z > 700) { format(str,sizeof(str),"..:: xReaperx - Player %s has been [Possibly] detected |Indoor Weapons| ::..",killer); Report(str); } return 1; } public OnPlayerText(playerid,text[]) { new str[130],player[24]; GetPlayerName(playerid,player,24); if(chat[playerid] >= 3) { format(str,sizeof(str),"..:: xReaperx - Player %s has been [Possibly] doing |Spam| ::..",player); Report(str); } return 1; } public Hp() { for(new i=0; i 100) { if(r[i][H]) break; format(str,sizeof(str),"..:: xReaperx - Player %s has been [Possibly] detected |Health > 100| ::..",player); Report(str); r[i][H] = 1; } new oldhealth = GetPlayerHealth(i,h); SetPlayerHealth(i,50); GetPlayerHealth(i,h); if(oldhealth == h) { if(r[i][H]) break; format(str,sizeof(str),"..:: xReaperx - Player %s has been [Possibly] detected |Timer Health| ::..",player); Report(str); r[i][H] = 1; } } } public Speed() { for(new i=0; i 40) { if(z > 700) break; if(r[i][S]) break; format(str,sizeof(str),"..:: xReaperx - Player %s has been [Possibly] detected |Airbreak| ::..",player); Report(str); r[i][S] = 1; } } if(GetPlayerState(i) == vehicle) { if(z > 700) { if(mph[i] > 240) { if(r[i][S]) break; format(str,sizeof(str),"..:: xReaperx - Player %s has been [Possibly] detected |Flying Vehicle| ::..",player); Report(str); r[i][S] = 1; } } if(mph[i] > 240) { if(r[i][S]) break; format(str,sizeof(str),"..:: xReaperx - Player %s has been [Possibly] detected |Speed| ::..",player); Report(str); r[i][S] = 1; } } } } public Stick() { for(new i=0; i 0 && x - x1 < 16 && x - x1 > 0) if(y - y1 < 16 && y - y1 > 0 && p1 - p2 < 20) { if(r[i][ST]) break; format(str,sizeof(str),"..:: xReaperx - Player %s has been [Possibly] detected |Stick| ::..",player); Report(str); r[i][ST] = 1; } } } } public Clear() { for(new i=0; i 0 && playermoney >= moneys) { GivePlayerMoney(playerid, (0 - moneys)); GivePlayerMoney(giveplayerid, moneys); format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys); SendClientMessage(playerid, COLOR_YELLOW, string); format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid); SendClientMessage(giveplayerid, COLOR_YELLOW, string); printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid); } else { SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount."); } } else { format(string, sizeof(string), "%d is not an active player.", giveplayerid); SendClientMessage(playerid, COLOR_YELLOW, string); } return 1; } // PROCESS OTHER COMMANDS return 0; } //---------------------------------------------------------- public OnPlayerSpawn(playerid) { SetPlayerInterior(playerid,0); if(gTeam[playerid] == TEAM_GROVE) { SetPlayerColor(playerid,COLOR_GREEN); // Green } else if(gTeam[playerid] == TEAM_BALLAS) { SetPlayerColor(playerid,COLOR_BLUE); // Blue } return 1; } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ public SetupPlayerForClassSelection(playerid) { SetPlayerInterior(playerid,14); SetPlayerPos(playerid,258.4893,-41.4008,1002.0234); SetPlayerFacingAngle(playerid, 90.0); SetPlayerCameraPos(playerid,256.0815,-43.0475,1003.0234); SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234); } //------------------------------------------------------------------------------ public OnPlayerRequestClass(playerid, classid) { SetPlayerClass(playerid, classid); SetupPlayerForClassSelection(playerid); gPlayerClass[playerid] = classid; switch (classid) { case 0..7: { GameTextForPlayer(playerid, "~g~Grove", 500, 3); } case 8..16: { GameTextForPlayer(playerid, "~g~Ballas", 500, 3); } } return 1; } //------------------------------------------------------------------------------ public GameModeExitFunc() { GameModeExit(); return 1; } //------------------------------------------------------------------------------ SetPlayerClass(playerid, classid) { if(classid == 0) { gTeam[playerid] = TEAM_GROVE; } else if(classid == 1) { gTeam[playerid] = TEAM_BALLAS; } } public SendPlayerFormattedText(playerid, const str[], define) { new tmpbuf[256]; format(tmpbuf, sizeof(tmpbuf), str, define); SendClientMessage(playerid, 0xFFFF00AA, tmpbuf); } public SendAllFormattedText(playerid, const str[], define) { new tmpbuf[256]; format(tmpbuf, sizeof(tmpbuf), str, define); SendClientMessageToAll(0xFFFF00AA, tmpbuf); } 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; }