SA-MP Forums Archive
3 horrible problems :p - 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: 3 horrible problems :p (/showthread.php?tid=263611)



3 horrible problems :p - Michael@Belgium - 22.06.2011

Well, my derby gamemode is almost finished. i worked a lot on it :S But i have 3 problems that i can't solve...

1) If someone dies the textdraw must change

SOLVED

2 & 3) Player dont spawn after round ends + spawning in another map don't work

I just don't get it:
pawn Код:
forward EndRound();
public EndRound()
{
      if(EndRoundCounter == 0)
      {
        //...
        NewMap();
        return 1;
      }
//....
}

forward NewMap();
public NewMap()
{
    CreateNewVehicles();
    foreach(Player,i)
    {
        DontSpectating(i);
        //....
        new OtherSpawn = random(20);
        switch (OtherSpawn)
        {
            case 0:
            {
                new rand1=random(30);
                if(!IsPlayerInVehicle(i, CarMap1[rand1])) return PutPlayerInVehicle(i, CarMap1[rand1], 0);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Arena 666");
            }
            //i have 9 cases just like the first one but other "CarMap"
        }
    }
    return 1;
}

stock DontSpectating(playerid)
{
    PlayerIsSpectating[playerid] = 0;
    TogglePlayerSpectating(playerid,0);
    SpawnPlayer(playerid);
}
Plz help me, if you need more info reply ^^


Re: 3 horrible problems :p - Michael@Belgium - 23.06.2011

no one ? xD


Re: 3 horrible problems :p - [HiC]TheKiller - 23.06.2011

OK, for your first issue, instead of calling a timer and wasting server resources on something that doesn't work, use OnPlayerDeath.

pawn Код:
new pl;
public OnPlayerDeath(playerid, killerid, reason)
{
      pl++;
      format(string,sizeof (string),"%i", pl);
      TextDrawSetString(Textdraw2,string);
      TextDrawShowForAll(Textdraw2);
      return1;
}
For the second issue, I can see multiple problems with the code. Your foreach is calling that Rcon command for each person on the server. Also, is it even calling that function? Try using
pawn Код:
print("test");
In your code and then checking the console to see if it is actually running.


Re: 3 horrible problems :p - Michael@Belgium - 23.06.2011

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
OK, for your first issue, instead of calling a timer and wasting server resources on something that doesn't work, use OnPlayerDeath.

pawn Код:
new pl;
public OnPlayerDeath(playerid, killerid, reason)
{
      pl++;
      format(string,sizeof (string),"%i", pl);
      TextDrawSetString(Textdraw2,string);
      TextDrawShowForAll(Textdraw2);
      return1;
}
For the second issue, I can see multiple problems with the code. Your foreach is calling that Rcon command for each person on the server. Also, is it even calling that function? Try using
pawn Код:
print("test");
In your code and then checking the console to see if it is actually running.
Hmm ... Thanks for the first one ^^
And lol about the second ... i edited the script and i added this:

pawn Код:
forward NewMap();
public NewMap()
{
    foreach(Player,i)
    {
        //....
        new OtherSpawn = random(20);
        switch (OtherSpawn)
        {
            case 0:
            {
                print("Went to map 1");//what you said ..
                new rand1=random(30);
                if(!IsPlayerInVehicle(i, CarMap1[rand1])) return PutPlayerInVehicle(i, CarMap1[rand1], 0);
                SendClientMessage(i, COLOR_ORANGE,"You were put randomly in a vehicle ...");
                SendRconCommand("mapname Arena 666");
            }
            //i have added it to under case 2 untill 9
        }
    }
    return 1;
}
And damn ... it's just don't work !? I don't saw: 'Went to map' in my server.exe ... is it because the SendRconCommand() ?!


Re: 3 horrible problems :p - [HiC]TheKiller - 23.06.2011

It seems that you NewMap function is not being called. Is it on a timer? If so, post that code . The Rcon command isn't causing it but it will be a problem.


Re: 3 horrible problems :p - Michael@Belgium - 23.06.2011

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
It seems that you NewMap function is not being called. Is it on a timer? If so, post that code . The Rcon command isn't causing it but it will be a problem.
It's called when i type a cmd:

pawn Код:
COMMAND:startround(playerid, params[])
    {
        if(IsPlayerAdmin(playerid))
        {
            //...
            EndRound();//here under

        }
        else SendClientMessage(playerid, COLOR_RED, "You may not use this cmd !");
        return 1;
    }

forward EndRound();
public EndRound()
{
      if(EndRoundCounter == 0)
      {
       //...
        NewMap();//<--
        return 1;
      }
}



Re: 3 horrible problems :p - Michael@Belgium - 29.06.2011

Ow damn , sorry for this bump but can somone fix that last issue ?