I have added a custom weapon. What will be the function to play sound on fire??
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu else if(cmd == "slap")
{
if(status[player.ID].Level < 3) MessagePlayer("[#FFDD33]Information:[#FFFFFF] Unauthorized Access", player);
else if(!arguments) MessagePlayer("[#FFDD33]Command Error:[#FFFFFF] Use /" + cmd + " [plr] [Reason]", player);
else if(NumTok(arguments, " ") < 2) MessagePlayer("[#FFDD33]Command Error:[#FFFFFF] Use /" + cmd + " [plr] [Reason]", player);
else
{
local plr = FindPlayer(GetTok(arguments, " ", 1));
if(!plr) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] Invalid Player", player);
else if(status[player.ID].Level < status[plr.ID].Level) MessagePlayer("[#FFDD33]Usage Error:[#FFFFFF] You cannot give any admin higher than you", player);
else
{
plr.Pos = Vector(plr.Pos.x, plr.Pos.y, plr.Pos.z + 5);
local reas = GetTok(arguments, " ", 2);
Message("[#FFDD33]Administrator Command:[#FFFFFF] Admin[" + player.Name + "] slapped player : " + plr.Name + " Reason : " + reas + ".");
}
}
}
The syntax of this code is: /cmd player reason. When I type the reason suppose I typed Spawn killing, it will only type spawn as reason. How to make it correct.
player.Immunity = 31;
MessagePlayer("Spawn Protection Enabled", player);
NewTimer("visibility", 5000, 1, player.ID);
function visibility(player)
{
player.Immunity = 0;
MessagePlayer("Spawn Protection Disabled", player);
}
An error has occured[trying to set in integer]
else if(cmd == "gotoloc")
{
if(!arguments) MessagePlayer("Wrong Syntax. Use /" + cmd + " <Name> ", player);
else
{
local q = QuerySQL(tele, "SELECT * FROM Locations WHERE Name = '" + arguments + "'");
if(!q) MessagePlayer("Location does not exist.", player);
else
{
player.IsFrozen = true;
NewTimer("gotoloc", 1000, 1, arguments, player);
local plr = GetSQLColumnData(q, 1);
MessagePlayer("You are being teleported to location: " + arguments + " made by: " + plr + ".", player);
}
}
}
function gotoloc(player, arguments )
{
local q = QuerySQL(tele, "SELECT * FROM Locations WHERE Name = '" + arguments +"'");
if(q)
{
xaxis = GetSQLColumnData(q, 2);
yaxis = GetSQLColumnData(q, 3);
zaxis = GetSQLColumnData(q, 4);
player.Pos = Vector(xaxis, yaxis, zaxis);
player.IsFrozen = false;
}
}
tele <- ConnectSQL( "databases/teleport.db" );
QuerySQL( tele, "CREATE TABLE IF NOT EXISTS spawn ( Autospawn TEXT, xaxis VARCHAR(25), yaxis VARCHAR(25), zaxis VARCHAR(25), Name VARCHAR(32) )" );
[/spoiler]if(cmd == "setspawnloc")
{
local q = QuerySQL(tele, "SELECT * FROM spawn WHERE Name = '" + player.Name + "'");
if(!q)
{
QuerySQL(tele, "INSERT INTO spawn ( Autospawn, xaxis, yaxis, zaxis, Name ) VALUES ( 'true' , '" + player.Pos.x + "' , '" + player.Pos.y + "' , '" + player.Pos.z + "', '" + player.Name + "' ) ");
}
else
{
QuerySQL(tele, "UPDATE spawn SET xaxis = '" + player.Pos.x + "' WHERE Name = '" + player.Name + "'");
QuerySQL(tele, "UPDATE spawn SET yaxis = '" + player.Pos.y + "' WHERE Name = '" + player.Name + "'");
QuerySQL(tele, "UPDATE spawn SET zaxis = '" + player.Pos.z + "' WHERE Name = '" + player.Name + "'");
QuerySQL(tele, "UPDATE spawn SET Autospawn = 'true' WHERE Name = '" + player.Name + "'");
MessagePlayer("Your spawnloc is updated and set to true. To disable it, use /spawnloc false", player);
}
}
else if(cmd == "spawnloc")
{
if(!arguments) MessagePlayer("Error Unknown Syntax. Use /" + cmd + " <true/false>", player);
local q = QuerySQL(tele, "SELECT * FROM spawn WHERE Name = '" + player.Name + "'");
if(!q)
{
MessagePlayer("You didnot set any spawn location. Use /setspawnloc to set spawn location.", player);
}
else
{
if(arguments == "true")
{
QuerySQL(tele, "UPDATE spawn SET Autospawn = 'true' WHERE Name = '" + player.Name + "'");
}
if(arguments == "false")
{
QuerySQL(tele, "UPDATE spawn SET Autospawn = 'false' WHERE Name = '" + player.Name + "'");
}
// if(!arguments == "true", "false")
else {
MessagePlayer("Error Unknown Syntax. Use /" + cmd + " <true/false>", player);
}
}
}
[/spoiler]function onPlayerSpawn(player)
{
local q = QuerySQL(tele, "SELECT * FROM spawn WHERE Name = '" + player.Name + "'");
if( q && GetSQLColumnData(q, 0) == "true" )
{
local
xspawn = GetSQLColumnData(q, 1).tointeger(),
yspawn = GetSQLColumnData(q, 2).tointeger(),
zspawn = GetSQLColumnData(q, 3).tointeger();
player.Pos = Vector(xspawn, yspawn, zspawn);
MessagePlayer("You are Spawned at your saved location", player);
}
else
MessagePlayer("You are spawned", player);
}
[/spoiler]
sploc <- ConnectSQL("databases/spawnloc.db");
QuerySQL( sploc, "CREATE TABLE IF NOT EXISTS spawn ( Name VARCHAR(32), Autospawn TEXT, xaxis VARCHAR(25), yaxis VARCHAR(25), zaxis VARCHAR(25) )" );
print("spawnloc system loaded");
if(cmd == "setspawnloc")
{
local q = QuerySQL(sploc, "SELECT * FROM spawn WHERE Name = '" + player.name + "'");
if(!q)
{
QuerySQL(sploc, "INSERT INTO spawn ( Name, Autospawn, xaxis, yaxis, zaxis ) VALUES ( '" + player.name + "' , 'true' , '" + player.Pos.x + "' , '" + player.Pos.y + "' , '" + player.Pos.z + "') ");
}
else
{
QuerySQL(sploc, "UPDATE spawn SET xaxis = '" + player.Pos.x + "' WHERE Name = '" + player.name + "'");
QuerySQL(sploc, "UPDATE spawn SET yaxis = '" + player.Pos.y + "' WHERE Name = '" + player.name + "'");
QuerySQL(sploc, "UPDATE spawn SET zaxis = '" + player.Pos.z + "' WHERE Name = '" + player.name + "'");
QuerySQL(sploc, "UPDATE spawn SET autospawn = 'true' WHERE Name = '" + player.name + "'");
MessagePlayer("Your spawnloc is updated and set to true. To disable it, use /spawnloc false", player);
}
}
if(cmd == "spawnloc")
{
// arguments = arguments.tolower();
if(!arguments) MessagePlayer("Error Unknown Syntax. Use /" + cmd + " <true/false>", player);
local q = QuerySQL(sploc, "SELECT * FROM spawn WHERE Name = '" + player.name + "'");
if(!q)
{
MessagePlayer("You didnot set any spawn location. Use /setspawnloc to set spawn location.", player);
}
else
{
if(arguments == "true")
{
QuerySQL(sploc, "UPDATE spawn SET autospawn = 'true' WHERE Name = '" + player.name + "'");
}
if(arguments == "false")
{
QuerySQL(sploc, "UPDATE spawn SET autospawn = 'true' WHERE Name = '" + player.name + "'");
}
/* if(!arguments == "true", "false")
{
MessagePlayer("Error Unknown Syntax. Use /" + cmd + " <true/false>", player);
} */
}
}
function onScriptLoad()
{
locations <- ConnectSQL( "databases/locations.db");
print("Locations loaded.");
}
function onPlayerCommand(player, command, arguments)
{
if(cmd == "saveloc")
{
if(!arguments) MessagePlayer("Use /" + cmd + " <Name>", player);
else
{
local q = QuerySQL(locations, "SELECT * FROM location WHERE Name = '" + escapeSQLString(arguments) +"' ");
if(!q)
{
// Name of the location
// Name of the player who saved it
// it's axis
QuerySQL(locations, "INSERT INTO location ( Name, Made, Pos ) VALUES ('" + arguments(string) + "', '" + player.Name + "', '" + escapeSQLString(player.Pos) "')");
MessagePlayer("[#CCFF66]** Location saved. Use /gotoloc " + arguments + ".", player);
}
}
}
if(cmd == "gotoloc")
{
if(!text) MessagePlayer("Use /" + cmd + " <Name>", player);
else
{
local q = QuerySQL(locations, "SELECT * FROM location WHERE Name = '" + escapeSQLString(arguments) + "'");
local
x = GetSQLColumnData( q, 0), // name of the location
y = GetSQLColumnData( q, 1), // name of the player
z = GetSQLColumnData( q, 2), // axis
MessagePlayer("[#CCFF66]** You have been teleported to location: " + x + " Made By: " + y + ".", player);
}
}
}
[/spoiler] function onPlayerCommand(player, command, arguments)
{
if(cmd == "sethp")
{
if(!arguments) MessagePlayer("[#CCFF66]** Use /" + cmd + " <hp> <Name>", player);
else
{
local parm = split(arguments, " " );
local hp = parm[0], plr = FindPlayer(parm[1]);
if(!plr) MessagePlayer("[#CCFF66]** Invalid Player", player);
else
{
plr.Health = hp;
Message("[#CCFF66]** Your hp has been set to :" + hp + "by :" + Player.Name + ".", plr);
}
}
}
}
[/spoiler]function onPlayerCommand(player, command, arguments)
{
if(cmd == "heal")
{
local hp = player.Health;
if(hp == 100) Message("[#FF3636]Error - [#8181FF]Use this command when you have less than 100% hp !");
else
{
MessagePlayer("[#FFFF81] ---> Please wait five seconds to heal !", player);
NewTimer("heal", 5000, 1);
}
}
function heal(player, command, arguments)
{
Player.health == 100.0;
MessagePlayer( "[#FFFF81]---> You have been healed !", player);
}