Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Ganz unten ist eine Anleitung wie man neue Rooms erstellt
- #include <a_samp>
- #define SERVERNAME "DEATHMATCHSERVER"
- #define SERVEROWNER "MAX MUSTERMANN"
- #define COLOR_RED 0xFF6347AA
- #define COLOR_BLUE 0x33CCFFAA
- #define COLOR_GREEN 0x9ACD32AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_GREY 0xAFAFAFAA
- new playerroom[MAX_PLAYERS];
- new playerkills[MAX_PLAYERS];
- new playerdeaths[MAX_PLAYERS];
- new Float:playerspawns[MAX_PLAYERS][3];
- main()
- {
- print(" ");
- print(" ");
- print(" ");
- print("+-----------------------------------------+");
- print("| FREE DM by Tion 1.0.0 |");
- print("+-----------------------------------------+");
- print("|");
- print("+ http://Streets-of-SA.de/");
- print(" ");
- print(" ");
- print(" ");
- }
- public OnGameModeInit()
- {
- AddPlayerClass(0, 2737.7942, -1760.0331, 44.1401 ,299.8479, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnGameModeExit()
- {
- SendClientMessageToAll(COLOR_GREY, "* Der Server wurde heruntergefahren, alle werden gekickt");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i)) Kick(i);
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- playerroom[playerid] = 0;
- playerkills[playerid] = 0;
- playerdeaths[playerid] = 0;
- new PlayerName[MAX_PLAYER_NAME];
- new string[128];
- GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
- format(string, sizeof(string), "*%s betritt den Server", PlayerName);
- SendClientMessageToAll(COLOR_GREY, string);
- SendClientMessage(playerid, COLOR_GREY, " ");
- SendClientMessage(playerid, COLOR_GREY, " ");
- SendClientMessage(playerid, COLOR_GREY, " ");
- SendClientMessage(playerid, COLOR_YELLOW, "Wilkommen auf "SERVERNAME"");
- SendClientMessage(playerid, COLOR_YELLOW, "Du kannst nun spawnen und dir dann einen Room aussuchen");
- SendClientMessage(playerid, COLOR_YELLOW, "Zum Spawnen klicke einfach unten auf den Balken mit den Pfeilen");
- SendClientMessage(playerid, COLOR_YELLOW, "auf die Schaltfläche \"Spawn\"...");
- SendClientMessage(playerid, COLOR_GREY, " ");
- SendClientMessage(playerid, COLOR_GREY, " ");
- // Hier nix hin wegen dem "Connected to SAMP 03c Server"
- SpawnPlayer(playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new PlayerName[MAX_PLAYER_NAME];
- new string[128];
- GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
- format(string, sizeof(string), "*%s verlässt den Server", PlayerName);
- SendClientMessageToAll(COLOR_GREY, string);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new playername[256];
- GetPlayerName(playerid, playername, sizeof(playername));
- new killername[256];
- GetPlayerName(killerid, killername, sizeof(killername));
- new string[256];
- if(killerid != 255 && playerroom[playerid] != 0)
- {
- format(string, sizeof(string), "* Du tötest %s , + 1 Kill", playername);
- SendClientMessage(killerid, COLOR_GREEN, string);
- format(string, sizeof(string), "* Du wurdest von %s , + 1 Death", killername);
- SendClientMessage(playerid, COLOR_RED, string);
- playerkills[killerid]++;
- playerdeaths[playerid]++;
- }
- else if(playerroom[playerid] != 0)
- {
- SendClientMessage(playerid, COLOR_RED, "* Du bist gestorben - + 1 Death");
- playerdeaths[playerid]++;
- }
- else
- {
- SendClientMessage(playerid, COLOR_YELLOW, "* Bitte wähle nun deinen neuen Raum");
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(playerroom[playerid] == 0)
- {
- SetPlayerPos(playerid, 2737.7942, -1760.0331, 44.1401);
- SetPlayerWorldBounds(playerid, 2836.069, 2619.307, -1654.228, -1883.197);
- /* Hier neue Rooms rein
- jeden Room mit einem "\n" ( für eine neue Zeile ) trennen... */
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Bitte wähle einen Room", "Grove Street [ ZUFUSS / UZI ]\nAirport LS [ ZUFUSS / MINIGUN ]", "Wählen", "");
- }
- else
- {
- SetPlayerPos(playerid, playerspawns[playerid][0], playerspawns[playerid][1], playerspawns[playerid][2]);
- }
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, "Chatmöglichkeiten:");
- SendClientMessage(playerid, COLOR_YELLOW, " Umgebungschat ( U ): /chat und dann \"Umgebungschat\"");
- SendClientMessage(playerid, COLOR_YELLOW, " Roomchat ( R ): /chat und dann \"Roomchat\"");
- SendClientMessage(playerid, COLOR_YELLOW, " Generalchat ( G ): /chat und dann \"Generalchat\"");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- return 0;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext, "/help", true) == 0)
- {
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, "(_.: "SERVERNAME" - Hilfe :._)");
- SendClientMessage(playerid, COLOR_YELLOW, " Roombefehle:");
- SendClientMessage(playerid, COLOR_YELLOW, " /exit | /users | /scores");
- SendClientMessage(playerid, COLOR_YELLOW, " Chatbefehle:");
- SendClientMessage(playerid, COLOR_YELLOW, " /chat");
- SendClientMessage(playerid, COLOR_YELLOW, " Sonstiges:");
- SendClientMessage(playerid, COLOR_YELLOW, " /credits");
- if(IsPlayerAdmin(playerid))
- {
- SendClientMessage(playerid, COLOR_YELLOW, " RCON-Adminstrationsbefehle:");
- SendClientMessage(playerid, COLOR_YELLOW, " /adminbefehle");
- }
- else
- {
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- }
- return 1;
- }
- /***** ROOMBEFEHLE *****/
- else if(strcmp(cmdtext, "/exit", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- playerroom[playerid] = 0;
- SendClientMessage(playerid, COLOR_YELLOW, " Bitte warte kurz...");
- SendClientMessage(playerid, COLOR_YELLOW, " Du wirst nun getötet, dir wird jedoch kein Death zugerechnet");
- SetPlayerHealth(playerid, 0);
- return 1;
- }
- return 1;
- }
- else if(strcmp(cmdtext, "/users", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- new giveplayername[MAX_PLAYERS];
- new count;
- SendClientMessage(playerid, COLOR_YELLOW, "Spieler in deinem Room:");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(playerroom[i] == playerroom[playerid])
- {
- GetPlayerName(i, giveplayername, sizeof(giveplayername));
- SendClientMessage(playerid, COLOR_GREEN, giveplayername);
- count++;
- }
- }
- }
- if(count == 0) { SendClientMessage(playerid, COLOR_RED, "* Du bist der einzige in diesem Room"); }
- if(count >= 10) { SendClientMessage(playerid, COLOR_RED, "* Benutze die \"Bild up\" bzw. \"Bild down\" Tasten um zu blättern"); }
- return 1;
- }
- return 1;
- }
- else if(strcmp(cmdtext, "/scores", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- new giveplayername[MAX_PLAYERS];
- new count;
- new besterid; new besterscore;
- new schlechterid; new schlechterscore;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(playerroom[i] == playerroom[playerid])
- {
- if(playerkills[i] > besterscore) { besterid = i; besterscore = playerkills[i]; }
- if(playerdeaths[i] > schlechterscore) { schlechterid = i; schlechterscore = playerdeaths[i]; }
- count++;
- }
- }
- }
- if(count == 0)
- {
- SendClientMessage(playerid, COLOR_RED, "* Du bist der einzige in diesem Room !");
- }
- else
- {
- SendClientMessage(playerid, COLOR_YELLOW, " Am meisten getötet hat:");
- GetPlayerName(besterid, giveplayername, sizeof(giveplayername));
- format(giveplayername, sizeof(giveplayername), "%s ( %d Kills )", giveplayername, besterscore);
- SendClientMessage(playerid, COLOR_YELLOW, giveplayername);
- SendClientMessage(playerid, COLOR_YELLOW, " Am meisten gestorben ist:");
- GetPlayerName(schlechterid, giveplayername, sizeof(giveplayername));
- format(giveplayername, sizeof(giveplayername), "%s ( %d Deaths )", giveplayername, schlechterscore);
- SendClientMessage(playerid, COLOR_YELLOW, giveplayername);
- }
- return 1;
- }
- return 1;
- }
- /***** CHATBEFEHLE *****/
- else if(strcmp(cmdtext, "/chat", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Bitte wähle die Chatlocation", "In meinem Umkreis sichtbar\nIn meinem Room sichtbar\nFür alle sichtbar", "OK", "Abbrechen");
- }
- return 1;
- }
- /***** SONSTIGES *****/
- else if(strcmp(cmdtext, "/credits", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, "(_.: Credits :._)");
- SendClientMessage(playerid, COLOR_YELLOW, " Grundscript:");
- SendClientMessage(playerid, COLOR_GREEN, " free-dm by Tion");
- SendClientMessage(playerid, COLOR_YELLOW, " erweitert von:");
- SendClientMessage(playerid, COLOR_GREEN, " "SERVEROWNER" ");
- SendClientMessage(playerid, COLOR_YELLOW, " Für den Server:");
- SendClientMessage(playerid, COLOR_GREEN, " "SERVERNAME" ");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- }
- return 1;
- }
- /***** ADMINSTRATIONSBEFEHLE *****/
- else if(strcmp(cmdtext, "/adminbefehle", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- if(IsPlayerAdmin(playerid))
- {
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_GREEN, "(_.: Adminstrationsbefehle "SERVERNAME" :._)");
- SendClientMessage(playerid, COLOR_YELLOW, " /rcon login [ PASSWORT ]");
- SendClientMessage(playerid, COLOR_YELLOW, " /rcon kick [ NAME ]");
- SendClientMessage(playerid, COLOR_YELLOW, " /rcon ban [ NAME ]");
- SendClientMessage(playerid, COLOR_YELLOW, " /rcon gravity [ NEUE SCHWERKRAFT ]");
- SendClientMessage(playerid, COLOR_YELLOW, " /rcon kick [ NAME ]");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- SendClientMessage(playerid, COLOR_YELLOW, " ");
- }
- else
- {
- SendClientMessage(playerid, COLOR_YELLOW, "* Für diesen Befehl musst du ein RCON-Adminstrator sein");
- }
- }
- return 1;
- }
- else
- {
- SendClientMessage(playerid, COLOR_YELLOW, "* Unbekannter Befehl");
- SendClientMessage(playerid, COLOR_YELLOW, " Benutze /help für eine Liste aller Befehle");
- }
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 1) // Roomwahl
- {
- if(!response)
- {
- SendClientMessage(playerid, COLOR_RED, "* Bei uns musst du einen Room wählen");
- return 1;
- }
- SendClientMessage(playerid, COLOR_RED, "Benutze \"/exit\" um diesen Room zu verlassen");
- SetPlayerVirtualWorld(playerid, listitem); // Um die Locations mehrere male benutzen zu können
- playerroom[playerid] = listitem + 1;
- switch(listitem)
- {
- case 0: // Grove Street
- {
- GivePlayerWeapon(playerid, 28, 500);
- switch(random(10))
- {
- case 0: { playerspawns[playerid][0] = 2504.9829; playerspawns[playerid][1] = -1694.7018; playerspawns[playerid][2] = 17.9575; }
- case 1: { playerspawns[playerid][0] = 2490.7476; playerspawns[playerid][1] = -1695.7056; playerspawns[playerid][2] = 22.2326; }
- case 2: { playerspawns[playerid][0] = 2471.8508; playerspawns[playerid][1] = -1695.3878; playerspawns[playerid][2] = 13.5153; }
- case 3: { playerspawns[playerid][0] = 2452.4304; playerspawns[playerid][1] = -1682.1855; playerspawns[playerid][2] = 13.5066; }
- case 4: { playerspawns[playerid][0] = 2454.1157; playerspawns[playerid][1] = -1647.4116; playerspawns[playerid][2] = 13.4718; }
- case 5: { playerspawns[playerid][0] = 2463.1699; playerspawns[playerid][1] = -1647.2560; playerspawns[playerid][2] = 13.4668; }
- case 6: { playerspawns[playerid][0] = 2480.6689; playerspawns[playerid][1] = -1649.2880; playerspawns[playerid][2] = 13.4688; }
- case 7: { playerspawns[playerid][0] = 2498.8149; playerspawns[playerid][1] = -1642.4669; playerspawns[playerid][2] = 13.7826; }
- case 8: { playerspawns[playerid][0] = 2514.8372; playerspawns[playerid][1] = -1651.4110; playerspawns[playerid][2] = 14.3557; }
- case 9: { playerspawns[playerid][0] = 2524.1545; playerspawns[playerid][1] = -1664.0876; playerspawns[playerid][2] = 15.1382; }
- }
- SetPlayerWorldBounds(playerid, 2543.251, 2387.334, -1598.959, -1748.974);
- }
- case 1: // Airport LS
- {
- GivePlayerWeapon(playerid, 38, 999);
- switch(random(5))
- {
- case 0: { playerspawns[playerid][0] = 1959.9795; playerspawns[playerid][1] = -2350.6179; playerspawns[playerid][2] = 13.5469; }
- case 1: { playerspawns[playerid][0] = 1650.8014; playerspawns[playerid][1] = -2545.6108; playerspawns[playerid][2] = 13.5469; }
- case 2: { playerspawns[playerid][0] = 1524.6760; playerspawns[playerid][1] = -2394.8601; playerspawns[playerid][2] = 13.5547; }
- case 3: { playerspawns[playerid][0] = 1380.6987; playerspawns[playerid][1] = -2533.2346; playerspawns[playerid][2] = 17.2344; }
- case 4: { playerspawns[playerid][0] = 1380.1570; playerspawns[playerid][1] = -2538.1484; playerspawns[playerid][2] = 13.5469; }
- }
- SetPlayerWorldBounds(playerid, 2318.883, 1261.695, -2183.225, -2767.491);
- }
- /*
- case x: // Vorlage für neuen Room
- {
- GivePlayerWeapon(playerid, 38, 999); // In diesem Fall eine Minigun ( Waffenid 39 ) mit 999 Schuss
- switch(random(ZUFALLZAHL)) // Zufallszahl durch die spawnpunkte ersetzen
- {
- case 0: { playerspawns[playerid][0] = 0.0; playerspawns[playerid][1] = 0.0; playerspawns[playerid][2] = 0.0; }
- // case x: { playerspawns[playerid][0] = X-Pos; playerspawns[playerid][1] = Y-Pos; playerspawns[playerid][2] = Z-Pos; } // wiederholen bis b in der case anweisung ZUFALLSZAHL - 1 ist
- }
- SetPlayerWorldBounds(playerid, X1, Y1, X2, Y2);
- }
- */
- }
- SetPlayerPos(playerid, playerspawns[playerid][0], playerspawns[playerid][1], playerspawns[playerid][2]);
- }
- else if(dialogid == 2) // Chat
- {
- if(!response) { return 1; }
- switch(listitem)
- {
- case 0: // Umgebung
- {
- ShowPlayerDialog(playerid, 3, DIALOG_STYLE_INPUT, "In meiner Umgebung etwas sagen", "Bitte gebe hier den Text ein, den du in der Umgebung anzeigen möchtest", "Sagen", "Doch nicht");
- }
- case 1: // Room
- {
- ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "In meinem Room etwas sagen", "Bitte gebe hier den Text ein, den du in deinem Room anzeigen möchtest", "Sagen", "Doch nicht");
- }
- case 2: // General
- {
- ShowPlayerDialog(playerid, 5, DIALOG_STYLE_INPUT, "In dem Generalchat etwas sagen", "Bitte gebe hier den Text ein, den du in dem Generalchat anzeigen möchtest", "Sagen", "Doch nicht");
- }
- }
- }
- else if(dialogid == 3) // Umgebungschat
- {
- if(!response) { return 1; }
- new string[256];
- new playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, sizeof(playername));
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- format(string, sizeof(string), "U: %s sagt: %s", playername, inputtext);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(PlayerToPoint(15, i, x, y, z))
- {
- SendClientMessage(i, COLOR_GREY, string);
- }
- }
- }
- }
- else if(dialogid == 4) // Roomchat
- {
- if(!response) { return 1; }
- new string[256];
- new playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, sizeof(playername));
- format(string, sizeof(string), "R: %s sagt: %s", playername, inputtext);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(playerroom[i] == playerroom[playerid])
- {
- SendClientMessage(i, COLOR_GREY, string);
- }
- }
- }
- }
- else if(dialogid == 5) // Generalchat
- {
- if(!response) { return 1; }
- new string[256];
- new playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, sizeof(playername));
- format(string, sizeof(string), "G: %s sagt: %s", playername, inputtext);
- SendClientMessageToAll(COLOR_GREY, string);
- }
- return 1;
- }
- /***** PlayerToPoint by Unbekannt *****/
- forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
- public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
- /*
- ##########################################################################
- ##################### ANLEITUNG NEUE ROOMS ERSTELLEN #####################
- ##########################################################################
- 1. Roomname ausdenken und ihn in den Dialog in Zeile 120 eintragen.
- Hinweis:
- Die Rooms müssen immer mit einem "\n" getrennt werden !
- 2. Den Raum unter "OnPlayerDialogResponse" eintragen
- Eine Schablone dafür sind in den Zeilen 356 bis 366
- */
Add Comment
Please, Sign In to add comment