Genau diesen Moment meine ich...
Random Spawn (Dauer)
- PStar
- Geschlossen
- Erledigt
Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!
Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
-
-
Das ist so minimal kurz, ich würde behaupten, dass das "normal" ist, zumindest wenn bei OnPlayerSpawn die Position gesetzt wird, da der Spieler logischerweise kurzzeitig am Spawn steht.
Mir ist es erst aufgefallen, als ich es ganz langsam angeschaut habe.Kommt dir die Position denn irgendwoher bekannt vor, also hast du dort deine Class Selection, oder nutzt du die Position irgendwo?
-
Ja ich nutze die Position als Hauptspawn...
-
Ok. Setzt du die Position des Spielers zu diesem Hauptspawn bei OnPlayerSpawn, oder wo nutzt du die überall?
Poste bitte die Codes, die die Koordinaten des Hauptspawns nutzen. -
Einmal unter OnGameModeInit mit -> AddPlayerClassOnplayerSpawn -> SetPlayerPos
OnPlayerRequrst -> SetPlayePos
public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid,384.5395,-2028.6428,7.8359);
return 1;
}public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid,384.5395,-2028.6428,7.8359);
return 1;
} -
Ist das alles was du unter OnPlayerSpawn stehen hast? Wie setzt du dann die Position zurück auf die Map/Arena? Hast du das in einem Filterscript?
-
public OnPlayerSpawn(playerid)
{
/*TextDrawShowForPlayer(playerid, Time);
TextDrawShowForPlayer(playerid, Date);
TextDrawShowForPlayer(playerid,Punkt4);
TextDrawShowForPlayer(playerid,Link);
TextDrawShowForPlayer(playerid,Befehle);
TextDrawShowForPlayer(playerid,Helpstats);*/
if(GetPVarInt(playerid,"indm")==1)
{
DmSpawn(playerid);
}
else if(GetPVarInt(playerid,"indm")==0)
{
new Spielerdatei[64];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
new Float:pos[3];
pos[0] = dini_Float(Spielerdatei,"posx");
pos[1] = dini_Float(Spielerdatei,"posy");
pos[2] = dini_Float(Spielerdatei,"posz");
if(pos[0] == 0.0 && pos[1] == 0.0 && pos[2] == 0)return SetPlayerPos(playerid,384.5395,-2028.6428,7.8359),SetPlayerVirtualWorld(playerid,0),SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,pos[0],pos[1],pos[2]);
SetPlayerInterior(playerid,dini_Int(Spielerdatei,"Interior"));
SetPlayerVirtualWorld(playerid,dini_Int(Spielerdatei,"VWorld"));
}
return 1;
}stock DmSpawn(playerid)
{
if(GetPVarInt(playerid,"DEAGLEDM")==1)
switch(random(8))
{
case 0:SetPlayerPos(playerid,285.2807,167.2459,1007.1794),SetPlayerInterior(playerid,3),SetPlayerVirtualWorld(playerid,DEAGLEDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,24,500),GivePlayerWeapon(playerid,25,500);
case 1:SetPlayerPos(playerid,300.7993,190.0469,1007.1794),SetPlayerInterior(playerid,3),SetPlayerVirtualWorld(playerid,DEAGLEDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,24,500),GivePlayerWeapon(playerid,25,500);
case 2:SetPlayerPos(playerid,267.6987,184.6336,1008.1719),SetPlayerInterior(playerid,3),SetPlayerVirtualWorld(playerid,DEAGLEDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,24,500),GivePlayerWeapon(playerid,25,500);
case 3:SetPlayerPos(playerid,262.3422,184.1638,1008.1719),SetPlayerInterior(playerid,3),SetPlayerVirtualWorld(playerid,DEAGLEDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,24,500),GivePlayerWeapon(playerid,25,500);
case 4:SetPlayerPos(playerid,261.2121,169.2189,1003.0234),SetPlayerInterior(playerid,3),SetPlayerVirtualWorld(playerid,DEAGLEDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,24,500),GivePlayerWeapon(playerid,25,500);
case 5:SetPlayerPos(playerid,228.9139,169.3709,1003.0234),SetPlayerInterior(playerid,3),SetPlayerVirtualWorld(playerid,DEAGLEDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,24,500),GivePlayerWeapon(playerid,25,500);
case 6:SetPlayerPos(playerid,188.7379,178.8978,1003.0234),SetPlayerInterior(playerid,3),SetPlayerVirtualWorld(playerid,DEAGLEDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,24,500),GivePlayerWeapon(playerid,25,500);
case 7:SetPlayerPos(playerid,189.1143,158.1188,1003.0234),SetPlayerInterior(playerid,3),SetPlayerVirtualWorld(playerid,DEAGLEDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,24,500),GivePlayerWeapon(playerid,25,500);
}
else if(GetPVarInt(playerid,"SDM")==1)
switch(random(10))
{
case 0:SetPlayerPos(playerid,781.8991,837.5376,5.8464),SetPlayerVirtualWorld(playerid,SDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,34,500);
case 1:SetPlayerPos(playerid,681.0347,972.9415,-12.7109),SetPlayerVirtualWorld(playerid,SDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,34,500);
case 2:SetPlayerPos(playerid,521.8394,968.1456,-23.4744),SetPlayerVirtualWorld(playerid,SDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,34,500);
case 3:SetPlayerPos(playerid,463.3968,882.5516,-28.3225),SetPlayerVirtualWorld(playerid,SDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,34,500);
case 4:SetPlayerPos(playerid,492.7878,786.3410,-22.1027),SetPlayerVirtualWorld(playerid,SDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,34,500);
case 5:SetPlayerPos(playerid,622.3457,748.0591,-13.4451),SetPlayerVirtualWorld(playerid,SDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,34,500);
case 6:SetPlayerPos(playerid,671.4337,729.3242,-4.4066),SetPlayerVirtualWorld(playerid,SDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,34,500);
case 7:SetPlayerPos(playerid,607.9719,852.9265,-43.0342),SetPlayerVirtualWorld(playerid,SDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,34,500);
case 8:SetPlayerPos(playerid,465.4101,882.3282,-28.6025),SetPlayerVirtualWorld(playerid,SDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,34,500);
case 9:SetPlayerPos(playerid,682.9614,923.9701,-40.7758),SetPlayerVirtualWorld(playerid,SDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,34,500);
}
else if(GetPVarInt(playerid,"GDM")==1)
switch(random(12))
{
case 0:SetPlayerPos(playerid,-975.975708,1060.983032,1345.671875),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 1:SetPlayerPos(playerid,-989.2897,1020.1741,1341.8732),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 2:SetPlayerPos(playerid,-988.6649,1097.2703,1342.9817),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 3:SetPlayerPos(playerid,-1023.4171,1075.6573,1346.8391),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 4:SetPlayerPos(playerid,-1043.0446,1060.3726,1345.8352),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 5:SetPlayerPos(playerid,-1062.4119,1060.3582,1347.0173),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 6:SetPlayerPos(playerid,-1061.2189,1024.6680,1346.2820),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 7:SetPlayerPos(playerid,-1088.0807,1047.1404,1347.3154),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 8:SetPlayerPos(playerid,-1114.0736,1020.8528,1343.9945),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 9:SetPlayerPos(playerid,-1127.3982,1057.4971,1346.3691),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 10:SetPlayerPos(playerid,-1114.2015,1096.0007,1341.8438),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
case 11:SetPlayerPos(playerid,-1117.9984,1095.1495,1341.8438),SetPlayerInterior(playerid,10),SetPlayerVirtualWorld(playerid,GDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,16,500);
}
else if(GetPVarInt(playerid,"MDM")==1)
switch(random(7))
{
case 0:SetPlayerPos(playerid,954.5148,2177.0125,1011.023),SetPlayerInterior(playerid,1),SetPlayerVirtualWorld(playerid,MDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,38,5000);
case 1:SetPlayerPos(playerid,961.0936,2152.3218,1011.0234),SetPlayerInterior(playerid,1),SetPlayerVirtualWorld(playerid,MDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,38,5000);
case 2:SetPlayerPos(playerid,950.7350,2172.2837,1011.0234),SetPlayerInterior(playerid,1),SetPlayerVirtualWorld(playerid,MDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,38,5000);
case 3:SetPlayerPos(playerid,951.5779,2141.4895,1011.0239),SetPlayerInterior(playerid,1),SetPlayerVirtualWorld(playerid,MDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,38,5000);
case 4:SetPlayerPos(playerid,953.4650,2139.7417,1011.0234),SetPlayerInterior(playerid,1),SetPlayerVirtualWorld(playerid,MDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,38,5000);
case 5:SetPlayerPos(playerid,963.7057,2112.2917,1011.0234),SetPlayerInterior(playerid,1),SetPlayerVirtualWorld(playerid,MDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,38,5000);
case 6:SetPlayerPos(playerid,962.7031,2102.5071,1011.0278),SetPlayerInterior(playerid,1),SetPlayerVirtualWorld(playerid,MDM),
ResetPlayerWeapons(playerid),GivePlayerWeapon(playerid,38,5000);
}
return 1;
} -
Ok, dann liegt es daran, dass es bei AddPlayerClass drin steht. Das ist auch vollkommen normal so.
Ablauf beim Spawn:Tot -> Spawn bei Position von AddPlayerClass/SetSpawnInfo -> OnPlayerSpawn -> Dortiges SetPlayerPos.
Wenn du verhindern willst, dass der Spieler bei der AddPlayerClass Position spawnt, dann musst du wie bereits gesagt [wiki]SetSpawnInfo[/wiki] nutzen, und zwar dort, wo der Spieler dem DM beitritt musst du es zu der DM-Spawn Koordinate setzen, und dort wo er es verlässt, da musst du es wieder zur AddPlayerClass Koordinate setzen.
Jetzt eben das Problem, dass du ja mehrere DM Spawns hast.Du kannst folgendes mal versuchen:
1) Beim Betreten der Arena setzt du die Position und setzt direkt danach über eine random-Funktion wie in DmSpawn das SetSpawnInfo (anstatt SetPlayerPos) des Spielers. Das wäre dann der nächste Spawn-Punkt nach dem Tod.
2) Bei OnPlayerSpawn machst du das ebenfalls so, anstatt DmSpawn rufst du dort die neue Funktion DmSpawnInfo (z.B. so genannt) auf, dann wird direkt nach dem Spawn die nächste Spawn-Koordinate schon gesetzt.Wenn der Spieler die Arena verlässt, dann setzt du SetSpawnInfo wieder zur AddPlayerClass Koordinate.
Versuche es mal so.
-
breadfish.de
Hat das Thema geschlossen.