Saveloc, set hp and set time scripts fix

Started by umar4911, Aug 11, 2017, 07:47 PM

Previous topic - Next topic

Xmair


Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

umar4911

Quote from: umar4911 on Aug 22, 2017, 04:19 PM
Quote from: Xmair on Aug 18, 2017, 04:24 AM
Quote from: umar4911 on Aug 15, 2017, 05:03 PM
Quote from: KAKAN on Aug 13, 2017, 08:52 AMhttps://pastebin.com/KeU1muUFStatus: Untested
thank you for the code.  Now plz help me in saveloc cmd
1. Make a table in the database for locations.
2. Insert data(location name, position) into the table when a player uses /saveloc
3. When a player uses /gotoloc, select data from the table and set his position according to the data.
It is gives me error that string does not exist.
I ued escapeSQLstring and it worked. Now please fix gotoloc cmd
if(cmd == "gotoloc")
{
if(!arguments) MessagePlayer("Use /" + cmd + " <Name>", player);
else
{

local q = QuerySQL(locations, "SELECT * FROM location WHERE Name = '" + escapeSQLString(arguments) + "'");
if(!q) MessagePlayer("[#CCFF66]** location does not exist ", player);
else
{
local
n = GetSQLColumnData( q, 0), // name of the location
p = GetSQLColumnData( q, 1), // name of the player
X = GetSQLColumnData( q, 2), // xaxis
Y = GetSQLColumnData( q, 3), // xaxis
Z = GetSQLColumnData( q, 4); // xaxis
Vector( X, Y Z);
MessagePlayer("[#CCFF66]** You have been teleported to location: " + n + " Made By: " + p + ".", player);

}
}
}
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Xmair

Change this    Vector( X, Y Z);toplayer.Pos =     Vector( X, Y Z);

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

umar4911

Quote from: Xmair on Sep 01, 2017, 04:34 AMChange this    Vector( X, Y Z);toplayer.Pos =     Vector( X, Y Z);
It worked but there is still a problem.
I saved few locations with from different places but I am always teleported to one location.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Xmair

Try usingplayer.Pos = Vector( X.tofloat( ), Y.tofloat( ), Z.tofloat( ) );

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

Mahmoud Tornado

Quote from: umar4911 on Aug 11, 2017, 07:47 PMCan anybody give me the code of Set time and set weather. The code of set timer in wiki is wrong!!
Here You Are Friend Umar <3 TesTed With Command Colors!
function onPlayerCommand(player, command, arguments)
text = arguments;

Settime
else if ( cmd == "settime" )
    {
     if ( !text ) MessagePlayer( "[#ff0000]Correct syntax : /settime <hr> <min>", player );
      else if ( split(text, " ").len() < 2) return MessagePlayer("[#ff0000]Correct syntax : /settime <hr> <min>", player )
      else
   {
   local a = split(text, " ");
      if ( !IsNum( a[0] )) MessagePlayer( "[#ffbb00]Format: /settime <hr> <min>", player );
      else if ( !IsNum( a[1] )) MessagePlayer( "[#ffbb00]Format: /settime <hr> <min>", player );
      else SetTime( a[0].tointeger(), a[1].tointeger() ) ; 
      }
   }

Set Weather
else if ( cmd == "setweather" )
{
if ( !text ) MessagePlayer( "[#ff0000]Usage: setweather [Weather/ID]", player );
else {
switch( text.tolower() )
{
case "4":
SetWeather( 4 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Sunny.");
break;
case "5":
SetWeather( 5 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Rainy.");
break;
case "0":
SetWeather( 0 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Clear Skies.");
break;
case "1":
SetWeather( 1 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To OverCast.");
break;
case "2":
SetWeather( 2 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Rainy-Lightning.");
break;
case "3":
SetWeather( 3 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Foggy.");
break;
case "6":
SetWeather( 6 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Dark Sky Partly Cloudy.");
break;
case "7":
SetWeather( 7 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Light Sky Partly Cloudy.");
break;
case "8":
SetWeather( 8 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To OverCast Partly Cloudy.");
break;
case "9":
SetWeather( 9 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Grey Sky Black Clouds." );
break;
case "10":
SetWeather( 10 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Fog And Gray.");
break;
}
}
}

!

#21
Quote from: Mahmoud Tornado on Sep 02, 2017, 01:51 AMSet Weather
else if ( cmd == "setweather" )
{
if ( !text ) MessagePlayer( "[#ff0000]Usage: setweather [Weather/ID]", player );
else {
switch( text.tolower() )
{
case "4":
SetWeather( 4 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Sunny.");
break;
case "5":
SetWeather( 5 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Rainy.");
break;
case "0":
SetWeather( 0 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Clear Skies.");
break;
case "1":
SetWeather( 1 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To OverCast.");
break;
case "2":
SetWeather( 2 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Rainy-Lightning.");
break;
case "3":
SetWeather( 3 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Foggy.");
break;
case "6":
SetWeather( 6 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Dark Sky Partly Cloudy.");
break;
case "7":
SetWeather( 7 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Light Sky Partly Cloudy.");
break;
case "8":
SetWeather( 8 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To OverCast Partly Cloudy.");
break;
case "9":
SetWeather( 9 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Grey Sky Black Clouds." );
break;
case "10":
SetWeather( 10 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Fog And Gray.");
break;
}
}
}
Don't make it hard.
if ( cmd == "setweather" )
{
if ( !text ) return MessagePlayer( "[#ff0000]Usage: setweather [Weather/ID]", player );
if ( !IsNum(text) ) return MessagePlayer( "[#ff0000]Use integers/numbers", player );
SetWeather( text.tointeger() );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To "+GetWeatherName());
return;
}

function GetWeatherName( )
{
switch( GetWeather() )
  {
  case 0 : return "Clear Skies";
  case 1 : return "OverCast";
  case 2 : return "Rainy-Lightning";
  case 3 : return "Foggy";
  case 4 : return "Sunny";
  case 5 : return "Rainy";
  case 6 : return "Dark Sky Partly Cloudy";
  case 7 : return "Light Sky Partly Cloudy";
  case 8 : return "OverCast Partly Cloudy";
  case 9 : return "Grey Sky Black Clouds";
  case 10 : return "Fog And Gray";
  default : return "Unknown";
  }
}

Discord: zeus#5155

Mahmoud Tornado

Quote from: zeus on Sep 02, 2017, 05:57 AM
Quote from: Mahmoud Tornado on Sep 02, 2017, 01:51 AMSet Weather
else if ( cmd == "setweather" )
{
if ( !text ) MessagePlayer( "[#ff0000]Usage: setweather [Weather/ID]", player );
else {
switch( text.tolower() )
{
case "4":
SetWeather( 4 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Sunny.");
break;
case "5":
SetWeather( 5 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Rainy.");
break;
case "0":
SetWeather( 0 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Clear Skies.");
break;
case "1":
SetWeather( 1 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To OverCast.");
break;
case "2":
SetWeather( 2 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Rainy-Lightning.");
break;
case "3":
SetWeather( 3 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Foggy.");
break;
case "6":
SetWeather( 6 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Dark Sky Partly Cloudy.");
break;
case "7":
SetWeather( 7 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Light Sky Partly Cloudy.");
break;
case "8":
SetWeather( 8 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To OverCast Partly Cloudy.");
break;
case "9":
SetWeather( 9 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Grey Sky Black Clouds." );
break;
case "10":
SetWeather( 10 );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To Fog And Gray.");
break;
}
}
}
Don't make it hard.
if ( cmd == "setweather" )
{
if ( !text ) return MessagePlayer( "[#ff0000]Usage: setweather [Weather/ID]", player );
if ( !IsNum(text) ) return MessagePlayer( "[#ff0000]Use integers/numbers", player );
SetWeather( text.tointeger() );
Message( "[#4acc0a] Admin "+ player.Name +" Set The Weather To "+GetWeatherName());
return;
}

function GetWeatherName( )
{
switch( GetWeather() )
  {
  case 0 : return "Clear Skies";
  case 1 : return "OverCast";
  case 2 : return "Rainy-Lightning";
  case 3 : return "Foggy";
  case 4 : return "Sunny";
  case 5 : return "Rainy";
  case 6 : return "Dark Sky Partly Cloudy";
  case 7 : return "Light Sky Partly Cloudy";
  case 8 : return "OverCast Partly Cloudy";
  case 9 : return "Grey Sky Black Clouds";
  case 10 : return "Fog And Gray";
  default : return "Unknown";
  }
}
Oh Thx :D

Mahmoud Tornado

Okay Here You Are Gotoloc And Saveloc { With Database }
https://forum.vc-mp.org/?topic=5131
And You Will See The Settime And Setweather Up This Post :D

umar4911

Quote from: Mahmoud Tornado on Sep 10, 2017, 01:55 PMOkay Here You Are Gotoloc And Saveloc { With Database }
https://forum.vc-mp.org/?topic=5131
And You Will See The Settime And Setweather Up This Post :D
Thanks for other codes. I get error in this gotoloc and saveloc. This error comes in both just the onplayercommand line number is different
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Mahmoud Tornado

Quote from: umar4911 on Sep 17, 2017, 08:48 AM
Quote from: Mahmoud Tornado on Sep 10, 2017, 01:55 PMOkay Here You Are Gotoloc And Saveloc { With Database }
https://forum.vc-mp.org/?topic=5131
And You Will See The Settime And Setweather Up This Post :D
Thanks for other codes. I get error in this gotoloc and saveloc. This error comes in both just the onplayercommand line number is different

lol it working with me.
can you give me pic for the problem ?

Xmair

Just read the error ONCE by yourself, if you still cannot understand it, please quit scripting.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

Mahmoud Tornado

Quote from: Xmair on Sep 17, 2017, 12:51 PMJust read the error ONCE by yourself, if you still cannot understand it, please quit scripting.
me ?

Xmair

Quote from: Mahmoud Tornado on Sep 17, 2017, 01:07 PM
Quote from: Xmair on Sep 17, 2017, 12:51 PMJust read the error ONCE by yourself, if you still cannot understand it, please quit scripting.
me ?
No.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

Mahmoud Tornado

Quote from: Xmair on Sep 17, 2017, 01:12 PM
Quote from: Mahmoud Tornado on Sep 17, 2017, 01:07 PM
Quote from: Xmair on Sep 17, 2017, 12:51 PMJust read the error ONCE by yourself, if you still cannot understand it, please quit scripting.
me ?
No.
i was quiting xDDDDDDDDDDDDDDD