Code Select
function onCheckpointEntered( player, checkpoint )
{
if( checkpoint == banca1 ) player.Pos = Vector(-938.624, -351.724, 7.22692)
else if( checkpoint == banca2 ) player.Pos = Vector(-937.681, -351.388, 17.8038)
}
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 MenuQuote from: Athanatos on Aug 01, 2019, 07:31 PMQuote from: MatheuS on Jul 29, 2019, 12:09 PMVery basic, but keep improving.He can also use the onPlayerChat() and parse the text using GetTok() . Easy task.
I'll make you a challenge, create the same commands using keys without using "/ command". I think you can do it, good luck.
Quote from: Sebastian on Jul 31, 2019, 07:05 AM
dofile("timers.nut")
[/noae][/noae][/noae][/noae][/noae][/noae][/noae]// ------------------------------------------------------------------------------------------------
srand((GetTickCount() % time()) / 3);
// ------------------------------------------------------------------------------------------------
_Timer <- {
// --------------------------------------------------------------------------------------------
m__Timers = { /* ... */ }
// --------------------------------------------------------------------------------------------
function Create(environment, listener, interval, repeat, ...)
{
// ----------------------------------------------------------------------------------------
// Prepare the arguments pack
vargv.insert(0, environment);
// ----------------------------------------------------------------------------------------
// Store timer information into a table
local data = {
Environment = environment,
Listener = listener,
Interval = interval,
Repeat = repeat,
Timer = null,
Args = vargv
};
// ----------------------------------------------------------------------------------------
local hash = split(data+"", ":")[1].slice(3, -1).tointeger(16);
// ----------------------------------------------------------------------------------------
// Create the timer instance
data.Timer = NewTimer("tm_TimerProcess", interval, repeat, hash);
// ----------------------------------------------------------------------------------------
// Store the timer information
m__Timers.rawset(hash, data);
// ----------------------------------------------------------------------------------------
// Return the hash that identifies this timer
return hash;
}
// --------------------------------------------------------------------------------------------
function Destroy(hash)
{
// See if the specified timer exists
if (m__Timers.rawin(hash))
{
// Destroy the timer instance
m__Timers.rawget(hash).Timer.Delete();
// Remove the timer information
m__Timers.rawdelete(hash);
}
}
// --------------------------------------------------------------------------------------------
function Exists(hash)
{
// See if the specified timer exists
return m__Timers.rawin(hash);
}
// --------------------------------------------------------------------------------------------
function Fetch(hash)
{
// Return the timer information
return m__Timers.rawget(hash);
}
// --------------------------------------------------------------------------------------------
function Clear()
{
// Process all existing timers
foreach (tm in m__Timers)
{
// Destroy the timer instance
tm.Timer.Delete();
}
// Clear existing timers
m__Timers.clear();
}
}
// ------------------------------------------------------------------------------------------------
tm_TimerProcess <- function(hash)
{
// See if the specified timer exists
if (_Timer.m__Timers.rawin(hash))
{
// Get the timer associated with the specified hash
local tm = _Timer.m__Timers.rawget(hash);
// Call the specified listener
tm.Listener.pacall(tm.Args);
// Calculate the remaining cycles
if (tm.Repeat && (--tm.Repeat <= 0))
{
// Release the timer
_Timer.Destroy(hash);
}
}
}
[/noae][/noae][/noae][/noae][/noae][/noae][/noae]/*
VoteSystem
Developed by: Lucas
Credits: Matheus/Takanaue (I did nothing but I'm here)
*/
VoteStarted <- false;
VoteText <- null;
VoteY <- 0;
VoteN <- 0;
VoteTime <- 0;
VoteList <- {};
function onScriptLoad()
{
N <- BindKey( true, 0x4E, 0, 0 );
Y <- BindKey( true, 0x59, 0, 0 );
}
function onPlayerJoin( player )
{
VoteList.rawset( player.ID, "none" );
}
function onPlayerPart( player, reason )
{
VoteList.rawdelete( player.ID );
}
function onKeyDown( player, key )
{
if ( key == N )
{
if ( VoteStarted )
{
switch ( VoteList[ player.ID ] )
{
case "yes":
VoteY > 0 ? VoteY -- : false;
VoteN ++;
VoteList.rawset( player.ID, "no" );
PrivMessage( player, "Okay, you've changed your vote." );
break;
case "none":
VoteN ++;
VoteList.rawset( player.ID, "no" );
PrivMessage( player, "Feedback computed." );
break;
default: break;
}
}
}
else if ( key == Y )
{
if ( VoteStarted )
{
switch ( VoteList[ player.ID ] )
{
case "no":
VoteY ++;
VoteN > 0 ? VoteN -- : false;
VoteList.rawset( player.ID, "yes" );
PrivMessage( player, "Okay, you've changed your vote." );
break;
case "none":
VoteY ++;
VoteList.rawset( player.ID, "yes" );
PrivMessage( player, "Feedback computed." );
break;
default: break;
}
}
}
}
function Result()
{
local y_calc, n_calc;
AnnounceAll( "The time is over!" ,1 );
Message( "[#DCDCDC]Result of the votes:" );
if ( VoteY == VoteN && VoteY > 0 ) y_calc = "50", n_calc = "50";
else if ( VoteY > VoteN ) y_calc = ( !VoteY ? "0" : ( 100 - ( ( VoteN.tofloat() / VoteY ) * 100 ) ) ), n_calc = ( !VoteN ? "0" : ( ( VoteN.tofloat() / VoteY ) * 100 ) );
else y_calc = ( !VoteY ? "0" : ( ( VoteY.tofloat() / VoteN ) * 100 ) ), n_calc = ( !VoteN ? "0" : ( 100 - ( VoteY.tofloat() / VoteN ) * 100 ) );
Message( "[#DCDCDC]- Number of votes yes: [#FF0000]" + VoteY + "[#DCDCDC](" + y_calc + "%)" );
Message( "[#DCDCDC]- Number of votes no: [#FF0000]" + VoteN + "[#DCDCDC](" + n_calc + "%)" );
// Resetting the results
VoteStarted = false;
VoteText = null;
VoteY = 0;
VoteN = 0;
foreach ( idx, val in VoteList ) VoteList.rawset( idx, "none" );
}
function VoteClock()
{
AnnounceAll( format( "Ends in " + VoteTime + " second%s...", VoteTime == 1 ? "" : "s" ), 1 );
VoteTime --;
}
function onPlayerCommand( player, cmd, text )
{
if ( cmd == "vote" )
{
if ( !text ) MessagePlayer( "/" + cmd + " <text/off>.", player );
else
{
if ( text == "off" )
{
if ( !VoteStarted ) MessagePlayer( "No vote in progress." player );
else
{
VoteStarted = false;
VoteText = null;
VoteY != 0 ? VoteY = 0 : false;
VoteN != 0 ? VoteN = 0 : false;
VoteTime = 0;
_Timer.Destroy( _Result );
_Timer.Destroy( _VoteClock );
Message( "[#9B30FF]* Admin. [#B5B5B5]" + player.Name + " [#9B30FF]closed the poll." );
}
}
else
{
if ( VoteStarted ) MessagePlayer( "There is a vote in progress.", player );
else
{
VoteStarted = true;
VoteText = text;
VoteTime = 29;
Message( "[#9B30FF]* Admin. [#B5B5B5]" + player.Name + " [#9B30FF]started a poll." );
Message( "[#DCDCDC]~ " + text + " ~\nPress [#00FF00]\"Y\" [#DCDCDC]to vote yes or [#FF0000]\"N\" [#DCDCDC]to vote no." );
AnnounceAll( "Ends in " + VoteTime + " seconds...", 1 );
_Result <- _Timer.Create( this, Result, 30000, 1 );
_VoteClock <- _Timer.Create( this, VoteClock, 1000, VoteTime );
}
}
}
}
}
[/noae][/noae][/noae][/noae][/noae][/noae][/noae]/vote TEXT //if your text is "OFF" the votation will be stopped
[/noae][/noae][/noae][/noae][/noae][/noae]To reply negatively press N and To reply positively press Y
[/noae][/noae][/noae][/noae][/noae][/noae]
Quote from: in01am24 on Jul 12, 2019, 09:19 PMScreenshot:Quote from: Rardodus Bruise on Jul 12, 2019, 09:33 AMI'm pretty sure I set it up. I changed my name and it looks like the GTA: VC directory is already there.Quote from: in01am24 on Jul 12, 2019, 04:50 AMmaybe you forgot to set up the 'tools>settings' MAYBE, I am not sure.
local ammo = params[1] //Error Here of Index 1
else if ( cmd == "setwep" )
{
if( !status[player.ID].LoggedIn ) MessagePlayer(" "+red+"You need to login first.", player);
else if ( status[player.ID].Level < 2 ) MessagePlayer(" "+dark+"You can not use this command.", player );
else if ( !text ) MessagePlayer(""+red+" [ERROR] "+yellow+" /" + cmd + " <player> <wep>", player );
else {
local params = split(text, " " ), plr = FindPlayer(params[0]), wep = GetWeaponID( params[1] ), ammo = params[2];
if( ( !ammo ) || ( !plr ) || ( !wep ) ) MessagePlayer(""+red+" [ERROR] "+yellow+" /" + cmd + " <player> <wep> <ammo>", player );
else {
plr.SetWeapon( wep, ammo );
Message(""+acmd+"Administrator "+player.Name+" has given "+plr.Name+" wep "+wep+" ammo: "+ammo+" ");
}
}
}