SA-MP Forums Archive
please help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: please help (/showthread.php?tid=246836)



please help - xir - 06.04.2011

I have a problem with this base system, when someone types /base when they get teleported they cant see anything

pawn Код:
COMMAND:base(playerid, params[])
{
    if(BaseOn == 0) return SendClientMessage(playerid, Red, "There is no base in progress, or the base has already started");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SetPlayerInterior(i, 15);
            SetSpawnInfo(i, T_ATT, 46, 2221.2100,-1148.9974,1025.7969,3.0111, 24, 500, 31, 500, 34, 500);
            SetSpawnInfo(i, T_DEF, 46, 2193.1692,-1143.9407,1029.7969,180.0461, 24, 500, 31, 500, 34, 500);
            GivePlayerWeapon(i, 24, 500);
            GivePlayerWeapon(i, 31, 500);
            GivePlayerWeapon(i, 34, 500);
        }
    }
    return 1;
}
And I think the problem is T_ATT, T_DEF, because they dont spawn as those. They spawn with other ranks, but it should set their team to that, how can I do it?

I also wanna the spawns random, so its 50 chance to join ATT/DEF. It should change their team and give their weapon when they type /base, please help, I am gettign tired of this now -.-


Re: please help - [BKR]LUCAGRABACR - 08.04.2011

By "can't see anything" you mean your character fall from the sky or just see grayish stuff?.

It's probably caused by wrong virtual world/interior/coordinates.


Re: please help - xir - 08.04.2011

Just grayish stuff.

Hm the interior should be right, so should the coordinates.

It is Jefferson Motel


Re: please help - BizzyD - 08.04.2011

Try this

pawn Код:
COMMAND:base(playerid, params[])
{
    if(BaseOn == 0) return SendClientMessage(playerid, Red, "There is no base in progress, or the base has already started");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            SetPlayerInterior(i, 15);
            SetPlayerPos(i,2215.454833, -1147.475585, 1025.796875);
            //SetSpawnInfo(i, T_ATT, 46, 2221.2100,-1148.9974,1025.7969,3.0111, 24, 500, 31, 500, 34, 500);
            //SetSpawnInfo(i, T_DEF, 46, 2193.1692,-1143.9407,1029.7969,180.0461, 24, 500, 31, 500, 34, 500);
            GivePlayerWeapon(i, 24, 500);
            GivePlayerWeapon(i, 31, 500);
            GivePlayerWeapon(i, 34, 500);
        }
    }
    return 1;
}



Re: please help - xir - 08.04.2011

I've done it like this now

pawn Код:
COMMAND:base(playerid, params[])
{
    if(BaseOn == 0) return SendClientMessage(playerid, Red, "There is no base in progress, or the base has already started");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new rand = random(sizeof(RandomSpawn));
            SetPlayerInterior(i, 15);
            SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
            SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
            GivePlayerWeapon(i, 24, 500);
            GivePlayerWeapon(i, 31, 500);
            GivePlayerWeapon(i, 34, 500);
        }
    }
    return 1;
}
And it works.
Can anyone make me a code, when a player types /base, he will randomly set to a team with

SetPlayerTeam(i, ...)

I've done some ways and I failed


Re: please help - xir - 08.04.2011

Please, help me, please


AW: please help - Nero_3D - 08.04.2011

Random ?

pawn Код:
SetPlayerTeam(playerid, random(2));



Re: please help - xir - 08.04.2011

Yeah

So I just need to put that in the cmd? Or some more code required?


AW: please help - Nero_3D - 08.04.2011

just that line and than the guy will be in team 0 or in team 1 because random(2) return values from 0 till 2 (also 0, 1)


Re: please help - xir - 08.04.2011

You said from 0 till 2? Then also 2? I just need 2 teams?

Also, can you make this work too?

pawn Код:
stock GetLowestCountTeam()
{
    new c0, c1;
    for (new i = 0; i < MAX_PLAYERS; i ++)
    {
           if (Team[i] == Team0) { c0 += 1; }
           else if (Team[i] == Team1) { c1 += 1; }
     }
     if (c0 < c1) return Team0;
     else if (c0 > c1) return Team1;
}
?