Vice City: Multiplayer

Server Development => Scripting and Server Management => Snippet Showroom => Topic started by: Gito Baloch on Feb 28, 2020, 07:40 AM

Title: Battle Arena!
Post by: Gito Baloch on Feb 28, 2020, 07:40 AM
function battletimer(playerid) {
    local player = FindPlayer(playerid);
    if (!player) return;
    player.Pos = Vector(-540.772, 792.789, 195.213);
    Message(">> BATTLE AREA << " + Player.Name + " has entered the battle area (/battle)")
    player.World = 50;
}


    if (cmd == "battle") {
        MessagePlayer(">> You have to wait 3 seconds to enter in /battle area",player );
        NewTimer("battletimer", 3000, 1, player.ID)
    }

CREDITS: Alecumadalin32 modified my me ;D
Title: Re: Battle Arena!
Post by: Sebastian on Feb 28, 2020, 12:22 PM
Why to wait 3 seconds, but more important why so many querysql calling?  You can use only one for updating all the data.
(Won't ask why you saving player data there)
Title: Re: Battle Arena!
Post by: Gito Baloch on Feb 28, 2020, 01:43 PM
fixed. (removed saving spawnloc there.)
Title: Re: Battle Arena!
Post by: Gito Baloch on Feb 28, 2020, 01:45 PM
? ? ? ye u have to wait for 3seconds to enter in battle area.
Title: Re: Battle Arena!
Post by: AroliS^ on Feb 28, 2020, 02:38 PM
Have you thought about onPlayerSpawn?


battle <- array(100,false);

function battletimer(playerid) {
    local player = FindPlayer(playerid);
    if (!player) return;
    battle[ playerid ] = true;
    player.Pos = Vector(-540.772, 792.789, 195.213);
    Message(">> BATTLE AREA << " + Player.Name + " has entered the battle area (/battle)")
    player.World = 50;
}


    if (cmd == "battle") {
       if ( battle == true ) MessagePlayer(">>Your already in battle.",player);
       else
       {
            MessagePlayer(">> You have to wait 3 seconds to enter in /battle area",player );
            NewTimer("battletimer", 3000, 1, player.ID)
        }
    }

onPlayerSpawn <- function(player)
{
   if ( battle[ player.ID ] == true )
   {
       player.Pos = Vector(-540.772, 792.789, 195.213);
   }
}

Title: Re: Battle Arena!
Post by: Gito Baloch on Feb 28, 2020, 03:53 PM
what you mean?