SA-MP Forums Archive
[Help Needed] Positions Spawn [Map Change] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help Needed] Positions Spawn [Map Change] (/showthread.php?tid=319016)



[Help Needed] Positions Spawn [Map Change] - ServerScripter - 17.02.2012

Hi , i have Map change system , the problem is whene Player X , connect to the server and he is in Round 2 , me Player Y whene i connect i be in Round 1 ! how to make the system check if the Players are in Round X and spawn me to this one ?


Re: [Help Needed] Positions Spawn [Map Change] - Toreno - 17.02.2012

When saying round, do you mean ROUND as MAP location?


Re: [Help Needed] Positions Spawn [Map Change] - ServerScripter - 17.02.2012

yes i mean Round or like "Map" so my Gamemod has Map Change system 2 round (2 maps )...


Re: [Help Needed] Positions Spawn [Map Change] - Toreno - 17.02.2012

You need to set a variable so once the there is a public which changes the current "MAP", it will store the number of the map in this variable. Then when a player joins to your server, you could check what is the current "MAP" and send him over there.


Re: [Help Needed] Positions Spawn [Map Change] - ServerScripter - 17.02.2012

i have this :
pawn Код:
forward NextMap(playerid,maps);
public NextMap(playerid,maps)
{
Cmaps++;
if(Cmaps>= maps) Cmaps=0;
switch(Cmaps)
{
    case 0:
    {
            if(gTeam[playerid] == TEAM_CT) SetPlayerPos(playerid,2533.8667,2753.3320,10.8203);
            if(gTeam[playerid] == TEAM_CT) SetPlayerFacingAngle(playerid,90.5278);
            if(gTeam[playerid] == TEAM_T) SetPlayerPos(playerid,2667.8340,2717.2986,10.8203);
            if(gTeam[playerid] == TEAM_T) SetPlayerFacingAngle(playerid,31.6018);
    }
    case 1:
    {
         if(gTeam[playerid] == TEAM_CT) SetPlayerPos(playerid,1801.1047,-2991.1992,6.1988);
         if(gTeam[playerid] == TEAM_CT) SetPlayerFacingAngle(playerid,183.9618);
         if(gTeam[playerid] == TEAM_T) SetPlayerPos(playerid,1846.0448,-3083.0525,6.6550);
         if(gTeam[playerid] == TEAM_T) SetPlayerFacingAngle(playerid,44.1783);
    }
}
}



Re: [Help Needed] Positions Spawn [Map Change] - Toreno - 17.02.2012

pawn Код:
new CurrentMap;

forward NextMap(playerid, maps);
public NextMap(playerid, maps) {
    Cmaps++;
    if(Cmaps >= maps) Cmaps = 0;
    switch(Cmaps) {
        case 0: {
            if(gTeam[playerid] == TEAM_CT) {
                SetPlayerPos(playerid,2533.8667,2753.3320,10.8203);
                SetPlayerFacingAngle(playerid,90.5278);
            } else if(gTeam[playerid] == TEAM_T) {
                SetPlayerPos(playerid,2667.8340,2717.2986,10.8203);
                SetPlayerFacingAngle(playerid,31.6018);
            }
            CurrentMap = 0;
        } case 1: {
            if(gTeam[playerid] == TEAM_CT) {
                SetPlayerPos(playerid,1801.1047,-2991.1992,6.1988);
                SetPlayerFacingAngle(playerid,183.9618);
            } else if(gTeam[playerid] == TEAM_T) {
                SetPlayerPos(playerid,1846.0448,-3083.0525,6.6550);
                SetPlayerFacingAngle(playerid,44.1783);
            }
            CurrentMap = 1;
        }
    }
}
Now, give me the code where it sets the player his position once he connects your server.


Re: [Help Needed] Positions Spawn [Map Change] - ServerScripter - 17.02.2012

ok i have this under onplayerlogin :
pawn Код:
MapTimer[playerid] = SetTimerEx("NextMap", 20000, true, "ii",playerid, 2);//as soon as the player logsin!
         //NOTE: see the "2" at the end that is for the maximum maps you have
         //these are positions of the first map
         if(gTeam[playerid] == TEAM_CT) SetPlayerPos(playerid,2533.8667,2753.3320,10.8203);
         if(gTeam[playerid] == TEAM_CT) SetPlayerFacingAngle(playerid,90.5278);
         if(gTeam[playerid] == TEAM_T) SetPlayerPos(playerid,2667.8340,2717.2986,10.8203);
         if(gTeam[playerid] == TEAM_T) SetPlayerFacingAngle(playerid,31.6018);



Re: [Help Needed] Positions Spawn [Map Change] - Toreno - 17.02.2012

I think you're wrong, 2 refers as MAP, not the maximum maps. What I mean is whenever someone logs in, he will automatically pointed to the second map, in that case, try changing "2" to "CurrentMap".


Re: [Help Needed] Positions Spawn [Map Change] - ServerScripter - 17.02.2012

i have changed :
pawn Код:
MapTimer[playerid] = SetTimerEx("NextMap", 20000, true, "ii",playerid, 2);
with :
pawn Код:
MapTimer[playerid] = SetTimerEx("NextMap", 20000, true, "ii",playerid, CurrentMap);
what else ? thanks


Re: [Help Needed] Positions Spawn [Map Change] - Toreno - 17.02.2012

Now, you should try it, until then I can't help you. You must try it first and tell me what it does now.