Hallo,
hab vor kurzem wieder mit dem Scripten angefangen und habe nun ein kleines Problem.
Ich habe eine Art Deathmatch Plattform erstellt wo man sich via. Befehl hinteleportieren kann.
Man spawnt immer wieder in dieser Deathmatch Arena bis man /exit ausfürt.
Nach 7-8 Deaths spawnt man aber komischerweise nicht mehr in der DM Arena, sondern bei der Position wo die Lobby ist.
Wenn ich einmal ungewollt in der Lobby gespawnt bin bzw. dieser Bug von dem ich spreche auftretet, passiert dass nur noch (ich spawne nur noch in der Lobby und muss manuell einmal /exit eingeben.
Code:
Befehl um in die DM Arena zu gelangen
Code
CMD:dv(playerid,params[])
{
new name[MAX_PLAYER_NAME], string[150];
GetPlayerName(playerid, name, sizeof(name));
new Float:health;
GetPlayerHealth(playerid,health);
if (health < 95.0)
{
SendClientMessage(playerid,WHITE,"{FF1717}ERROR:{FFFFFF} You need full HP to teleport!");
return 1;
}
if(PlayerInRound[playerid] == true)
return SendClientMessage(playerid,WHITE, "{FF1717}ERROR:{FFFFFF} You're already inside the Deathvillage.");
format(string, sizeof(string)," {6E6E6E}|- SERVER -| {FFFFFF}{F5BE18}{%06x} %s {56A4E4}has gone to Deathvillage. {FF0000}(/dv)", GetPlayerColor(playerid) >>> 8,name);
if(zaehler >= sizeof(RandomDeathVillageSpawns)) zaehler = 0;
SendClientMessageToAll(0xC4C4C4FF, string);
PlayerInRound[playerid] = true;
SpawnPlayerInRound(playerid);
return 1;
}
Alles anzeigen
Befehl um die Arena zu verlassen
Code
CMD:exit(playerid,params[])
{
if(PlayerInRound[playerid] == true)
{
PlayerInRound[playerid] = false;
SpawnPlayer(playerid);
}
return 1;
}
Callbacks:
OnPlayerSpawn (abgekürzt)
Code
public OnPlayerSpawn(playerid)
{
if(PlayerInRound[playerid] == false)
{
SendClientMessageToAll(-1, "Player spawned (not in Deathvillage)");
SetPlayerRandomPos(playerid);
}
if(PlayerInRound[playerid] == true) //ich weiß ist scheiße geschrieben, dient nur als test
{
SendClientMessageToAll(-1, "Player spawned in Deathvillage");
SpawnPlayerInRound(playerid);
}
return 1;
}
Alles anzeigen
Functions
Code
SpawnPlayerInRound(playerid)
{
SetPlayerPos(playerid, RandomDeathVillageSpawns[zaehler][0], RandomDeathVillageSpawns[zaehler][1], RandomDeathVillageSpawns[zaehler][2]);
zaehler++;
}
SetPlayerRandomPos
Code
//Creating Round Maps
#define MAX_ZONES 7
#define MAX_MAPNAME_LENGTH 30
new Float:GroveStreet[25][4] = {
{2404.96, -1650.93, 13.50, 269.61},
{2427.70, -1635.82, 13.43, 200.80},
{2446.17, -1619.55, 14.36, 270.74},
{2468.28, -1650.60, 13.47, 192.15},
{2489.18, -1645.79, 14.07, 171.29},
{2511.32, -1637.89, 13.85, 307.21},
{2533.23, -1644.56, 14.31, 190.27},
{2532.83, -1695.57, 13.39, 154.55},
{2537.14, -1707.84, 13.41, 54.16},
{2524.76, -1712.10, 13.53, 161.70},
{2538.73, -1729.83, 13.38, 250.81},
{2535.92, -1755.49, 13.54, 81.99},
{2511.56, -1779.65, 13.54, 90.82},
{2486.72, -1811.74, 15.85, 71.46},
{2458.58, -1785.45, 13.54, 33.67},
{2450.09, -1763.96, 13.58, 50.78},
{2429.04, -1773.64, 13.54, 92.89},
{2420.86, -1786.21, 13.54, 1.33},
{2391.62, -1755.14, 13.54, 76.35},
{2351.10, -1726.10, 13.53, 296.47},
{2423.75, -1713.23, 14.69, 3.96},
{2438.57, -1697.15, 17.85, 35.55},
{2436.68, -1653.11, 26.79, 14.68},
{2423.10, -1635.63, 27.59, 170.16},
{2424.01, -1615.49, 27.01, 162.45}
};
new Float:OceanDocks[25][4] = {
{2289.04, -2216.18, 13.54, 135.36},
{2277.14, -2203.95, 13.54, 153.78},
{2266.75, -2191.32, 8.77, 354.73},
{2264.24, -2166.68, 6.06, 49.25},
{2270.75, -2149.82, 6.06, 67.87},
{2241.78, -2125.27, 7.29, 49.07},
{2209.36, -2127.34, 13.54, 222.35},
{2190.11, -2103.44, 13.55, 45.31},
{2179.56, -2166.00, 13.54, 123.87},
{2162.79, -2172.83, 13.54, 50.92},
{2150.90, -2171.26, 19.66, 225.58},
{2136.48, -2195.84, 18.06, 207.53},
{2135.69, -2218.77, 13.38, 202.26},
{2138.77, -2245.24, 13.51, 136.84},
{2120.69, -2279.04, 13.49, 211.66},
{2162.44, -2300.59, 13.54, 227.07},
{2169.79, -2329.45, 13.54, 300.21},
{2192.63, -2323.15, 13.54, 305.46},
{2220.82, -2278.56, 14.76, 227.25},
{2240.89, -2259.89, 14.76, 235.52},
{2263.78, -2272.80, 14.76, 311.85},
{2272.08, -2270.96, 13.54, 137.60},
{2245.48, -2299.54, 13.54, 299.27},
{2269.07, -2308.41, 13.37, 299.27},
{2298.86, -2298.30, 13.54, 41.53}
};
new Float:Idlewood[25][4] = {
{1969.83, -1763.10, 13.54, 51.59},
{1982.22, -1751.62, 13.38, 355.62},
{1986.60, -1736.13, 15.96, 89.62},
{1980.07, -1727.69, 15.96, 182.68},
{1955.95, -1712.18, 15.07, 78.15},
{1955.73, -1675.64, 15.03, 78.71},
{1966.05, -1674.60, 15.96, 277.41},
{1926.69, -1658.64, 13.54, 180.99},
{1915.19, -1672.79, 13.44, 183.43},
{1928.47, -1697.22, 13.54, 183.43},
{1901.59, -1738.89, 13.40, 95.82},
{1863.59, -1739.13, 13.41, 87.36},
{1834.27, -1732.26, 13.43, 357.12},
{1835.54, -1711.11, 13.38, 175.72},
{1829.58, -1700.37, 13.54, 176.66},
{1844.55, -1797.38, 13.54, 256.38},
{1876.95, -1802.76, 13.54, 256.38},
{1892.57, -1826.87, 3.98, 258.26},
{1934.86, -1830.09, 7.07, 205.05},
{1976.31, -1866.99, 5.75, 49.97},
{1970.46, -1882.57, 13.54, 132.13},
{1939.97, -1883.85, 13.53, 86.26},
{1934.78, -1900.88, 15.03, 184.39},
{1879.28, -1923.78, 13.54, 208.83},
{1852.23, -1908.12, 19.84, 14.44}
};
new Float:TrumpsHouse[25][4] = {
{1130.95, -1996.34, 69.00, 189.37},
{1119.27, -2012.59, 74.42, 171.32},
{1115.12, -2027.75, 74.42, 287.88},
{1115.66, -2048.28, 74.42, 242.20},
{1130.61, -2057.73, 69.00, 306.31},
{1127.78, -2037.01, 69.76, 92.57},
{1164.68, -2094.68, 69.64, 251.05},
{1154.78, -2140.54, 68.92, 144.08},
{1090.32, -2158.31, 61.37, 99.15},
{1199.31, -2178.70, 54.96, 300.87},
{1229.97, -2139.72, 56.27, 0.09},
{1244.55, -2086.26, 59.03, 341.67},
{1295.84, -2088.94, 55.05, 242.78},
{1290.37, -2062.85, 58.78, 66.46},
{1278.12, -2030.86, 58.97, 89.02},
{1258.59, -2011.74, 59.45, 72.47},
{1239.05, -1990.89, 59.11, 92.97},
{1219.93, -1978.58, 62.09, 154.25},
{1192.32, -1980.67, 63.17, 169.86},
{1188.41, -1981.54, 63.57, 169.86},
{1153.01, -1938.67, 42.07, 108.19},
{1133.81, -1951.64, 47.57, 193.92},
{1122.59, -1964.35, 54.20, 137.71},
{1134.09, -1972.26, 58.72, 198.43},
{1126.36, -1980.50, 62.92, 2.73}
};
new Float:Shopping[25][4] = {
{1090.78, -1631.26, 13.61, 83.71},
{1116.28, -1630.06, 20.52, 359.30},
{1129.83, -1612.21, 18.54, 355.16},
{1165.35, -1637.76, 14.00, 174.71},
{1170.68, -1646.00, 14.00, 49.50},
{1192.34, -1655.44, 13.87, 192.94},
{1218.64, -1698.54, 13.54, 264.19},
{1270.40, -1692.46, 19.73, 86.49},
{1276.21, -1553.47, 13.55, 343.58},
{1261.57, -1524.75, 13.55, 85.01},
{1254.77, -1510.52, 10.04, 98.36},
{1240.90, -1499.81, 10.04, 81.06},
{1236.22, -1479.49, 13.54, 358.90},
{1209.91, -1477.37, 13.54, 89.90},
{1182.85, -1484.38, 13.64, 94.41},
{1158.65, -1500.85, 15.79, 151.75},
{1132.52, -1528.34, 15.63, 173.37},
{1114.87, -1514.33, 15.79, 54.43},
{1091.16, -1491.24, 15.43, 68.46},
{1106.58, -1469.39, 15.88, 318.11},
{1116.99, -1484.73, 22.76, 269.23},
{1097.60, -1507.45, 22.75, 203.61},
{1122.65, -1542.72, 22.75, 197.78},
{1149.07, -1524.14, 22.75, 98.36},
{1160.55, -1505.22, 22.75, 339.91}
};
new Float:Doherty[25][4] = {
{-2122.28, 152.78, 41.48, 0.32},
{-2128.69, 173.89, 35.29, 263.69},
{-2096.22, 135.79, 35.44, 0.35},
{-2043.91, 131.37, 28.83, 355.64},
{-2030.52, 143.01, 28.83, 269.84},
{-2035.83, 178.40, 28.84, 269.21},
{-2038.19, 210.20, 35.98, 90.96},
{-2030.63, 262.03, 34.75, 156.67},
{-2027.71, 299.61, 35.90, 145.89},
{-2047.98, 306.42, 40.21, 173.62},
{-2052.28, 304.11, 41.99, 179.44},
{-2063.26, 306.68, 41.99, 177.13},
{-2072.03, 306.54, 41.99, 178.74},
{-2090.21, 298.20, 40.88, 269.93},
{-2126.88, 300.04, 34.60, 263.36},
{-2127.10, 262.30, 35.86, 0.08},
{-2128.75, 221.54, 35.90, 356.40},
{-2063.25, 247.13, 35.31, 359.60},
{-2063.30, 260.26, 35.55, 180.17},
{-2060.42, 253.98, 37.33, 175.37},
{-2092.67, 175.44, 35.05, 84.31},
{-2101.37, 211.03, 35.28, 267.52},
{-2048.03, 170.31, 34.61, 359.65},
{-2068.98, 221.03, 36.02, 175.68},
{-2069.89, 135.09, 33.84, 1.50}
};
new Float:OceanFlats[25][4] = {
{-2694.48, 89.57, 4.33, 146.98},
{-2638.92, 121.67, 4.33, 90.42},
{-2673.71, 127.96, 4.41, 269.28},
{-2713.27, 128.78, 4.33, 271.75},
{-2758.90, 127.26, 7.03, 170.44},
{-2777.42, 77.63, 7.18, 248.27},
{-2770.59, 32.33, 7.18, 304.11},
{-2735.83, 14.15, 4.33, 358.23},
{-2679.04, 12.68, 4.33, 357.38},
{-2614.25, 32.03, 4.33, 357.25},
{-2627.39, -36.53, 4.33, 179.55},
{-2698.37, -46.87, 4.32, 89.31},
{-2718.37, -16.76, 4.34, 358.60},
{-2775.14, -26.72, 7.17, 268.67},
{-2734.92, 60.63, 13.09, 267.92},
{-2638.57, 73.83, 4.34, 49.74},
{-2667.29, 45.22, 4.33, 178.90},
{-2625.49, -5.39, 6.13, 271.39},
{-2677.51, -16.29, 4.93, 88.94},
{-2698.55, 51.92, 4.33, 358.32},
{-2635.82, 102.34, 4.33, 87.15},
{-2738.75, 121.94, 4.52, 179.08},
{-2752.80, 94.61, 7.03, 247.33},
{-2728.31, 75.28, 4.33, 1.35},
{-2757.91, -44.57, 6.93, 4.05}
};
SetPlayerRandomPos(playerid)
{
SendClientMessageToAll(-1, "DEBUG: SetPlayerRandomPos called");
switch(Round[r_areaid])
{
case 0: {
new rand = random(sizeof GroveStreet);
SetPlayerPos(playerid,GroveStreet[rand][0],GroveStreet[rand][1],GroveStreet[rand][2]);
SetPlayerFacingAngle(playerid,GroveStreet[rand][3]);
}
case 1: {
new rand = random(sizeof OceanDocks);
SetPlayerPos(playerid,OceanDocks[rand][0],OceanDocks[rand][1],OceanDocks[rand][2]);
SetPlayerFacingAngle(playerid,OceanDocks[rand][3]);
}
case 2: {
new rand = random(sizeof Idlewood);
SetPlayerPos(playerid,Idlewood[rand][0],Idlewood[rand][1],Idlewood[rand][2]);
SetPlayerFacingAngle(playerid,Idlewood[rand][3]);
}
case 3: {
new rand = random(sizeof TrumpsHouse);
SetPlayerPos(playerid,TrumpsHouse[rand][0],TrumpsHouse[rand][1],TrumpsHouse[rand][2]);
SetPlayerFacingAngle(playerid,TrumpsHouse[rand][3]);
}
case 4: {
new rand = random(sizeof Shopping);
SetPlayerPos(playerid,Shopping[rand][0],Shopping[rand][1],Shopping[rand][2]);
SetPlayerFacingAngle(playerid,Shopping[rand][3]);
}
case 5: {
new rand = random(sizeof Doherty);
SetPlayerPos(playerid,Doherty[rand][0],Doherty[rand][1],Doherty[rand][2]);
SetPlayerFacingAngle(playerid,Doherty[rand][3]);
}
case 6: {
new rand = random(sizeof OceanFlats);
SetPlayerPos(playerid,OceanFlats[rand][0],OceanFlats[rand][1],OceanFlats[rand][2]);
SetPlayerFacingAngle(playerid,OceanFlats[rand][3]);
}
}
SetCameraBehindPlayer(playerid);
return 1;
}
Alles anzeigen