Vice City: Multiplayer

Server Development => Scripting and Server Management => Script Showroom => Topic started by: Abbas_905 on Mar 08, 2024, 01:24 PM

Title: Dipeos command
Post by: Abbas_905 on Mar 08, 2024, 01:24 PM
Anyone i want diepos command u can give me diepos command i want to add, diepos command in my server
Title: Re: Dipeos command
Post by: PSL on Mar 09, 2024, 08:11 AM
The following code may help you
DiePos<-{}; //Create a table where you can store coordinates
function onPlayerSpawn(player)
{
if(DiePos.rawin(player.ID)) //If an ID exists in the table
    {
        player.Pos=DiePos.rawget(player.ID); //Restores the player to death point
        DiePos.rawdelete(player.ID); //Delete coordinates after recovery
    }
}
function onPlayerDeath(player,reason)
{
DiePos.rawset(player.ID,player.Pos); //After the player dies, the ID is used as the search object, and the death coordinates are stored in the table
}
Title: Re: Dipeos command
Post by: Xmair on Mar 09, 2024, 06:56 PM
Quote from: PSL on Mar 09, 2024, 08:11 AMThe following code may help you
DiePos<-{}; //Create a table where you can store coordinates
function onPlayerSpawn(player)
{
if(DiePos.rawin(player.ID)) //If an ID exists in the table
    {
        player.Pos=DiePos.rawget(player.ID); //Restores the player to death point
        DiePos.rawdelete(player.ID); //Delete coordinates after recovery
    }
}
function onPlayerDeath(player,reason)
{
DiePos.rawset(player.ID,player.Pos); //After the player dies, the ID is used as the search object, and the death coordinates are stored in the table
}

You should also remove the player data once the player disconnects.
function onPlayerPart(player, reason) {
    if (DiePos.rawin(player.ID))
        DiePos.rawdelete(player.ID);
}
Title: Re: Dipeos command
Post by: PSL on Mar 10, 2024, 06:25 AM
Thanks to Xmair for the tip. I forgot about the player quitting.
Another point is that when the player falls into the water, the coordinates are not recorded.
DiePos<-{}; //Create a table where you can store coordinates
function onPlayerPart(player, reason) {
    if (DiePos.rawin(player.ID))
        DiePos.rawdelete(player.ID);
}

function onPlayerSpawn(player)
{
if(DiePos.rawin(player.ID)) //If an ID exists in the table
    {
        player.Pos=DiePos.rawget(player.ID); //Restores the player to death point
        DiePos.rawdelete(player.ID); //Delete coordinates after recovery
    }
}
function onPlayerDeath(player,reason)
{
 if(reason!=43)
{
 DiePos.rawset(player.ID,player.Pos); //After the player dies, the ID is used as the search object, and the death coordinates are stored in the table
}
}
Title: Re: Dipeos command
Post by: Abbas_905 on Mar 13, 2024, 03:50 AM
thanks for it,
Title: Re: Dipeos command
Post by: Abbas_905 on Mar 13, 2024, 03:56 AM
else if(cmd == "lastpos" || cmd == "diepos")
 {
 if(!text) MessagePlayer("Syntax: /"+cmd+" <on/off>.",player);
 else {
 if(text == "on")
 {
 if(status[player.ID].Lastpos == true) MessagePlayer("[#FF0000]Your lastpos is already on.",player);
 else {
 status[player.ID].Lastpos = true;
 MessagePlayer("[#00FF00]You have turned on your lastpos/diepos.",player);
 }
 }
 if(text == "off")
 {
  if(status[player.ID].Lastpos == false) MessagePlayer("[#FF0000]Your lastpos is already off.",player);
 else {
  status[player.ID].Lastpos = false;
   MessagePlayer("[#00FF00]You have turned off your lastpos/diepos.",player);
 }
 }

 }
 }




This is right or no? if have errors so fix it and repost it,
Title: Re: Dipeos command
Post by: PSL on Mar 16, 2024, 08:45 AM
This script has no language formatting errors.
Title: Re: Dipeos command
Post by: Abbas_905 on Mar 19, 2024, 03:50 PM
Bro so now u and some others gived me functions not diepos command u can give me?  :(