Forcing Spawn/Eject.(UPDATED)

Started by [VM_U]Spectra.PhantoM^, Jan 17, 2016, 05:39 PM

Previous topic - Next topic

[VM_U]Spectra.PhantoM^

I was working on my own server. Built these. Now i know what ur gonna think that "Ultimate u nab this is useless" or  "Useless shit cmd".I TRYED people dont be rude down there in comments. Thanx.

function onPlayerCommand(player, command, arguments)
{
local params;
if (arguments != null) params = split(arguments, " ");
else params = split("", " ");

if (command == "forceeject")
{
local lvl = GetLevel( player );
if (params.len() < 1) EMessagePlayer(player, "Invalid parameters, /forceeject playername reason");

else if (GetLevel() < 7) EMessagePlayer(player,  "Command level too high");

else if (!FindPlayer(params[0])) EMessagePlayer(player,  "Unknown player %s", params[0]);

else

{

local plr = FindPlayer(params[0]);

local veh = player.Vehicle;
EMessageAll("Administrator %s has ejected %s.", player.Name, plr.Name, arguments.slice(params[0].len()));

plr.Eject();
}
return 1;
}

else if (command == "forcespawn")
{
local lvl = GetLevel( player );
if (params.len() < 1) EMessagePlayer(player, "Invalid parameters, /forcespawn playername reason");

else if (GetLevel() < 7) EMessagePlayer(player, "Command level too high");

else if (!FindPlayer(params[0])) EMessagePlayer(player, "Unknown player %s", params[0]);

else

{

local plr = FindPlayer(params[0]);

EMessageAll("Administrator %s has forced %s to spawn.", player.Name, plr.Name, arguments.slice(params[0].len()));

plr.Spawn();
}
return 1;

}

Updated.
function GetLevel( player )
{
local lvl =  GetSQLColumnData( QuerySQL( db, "SELECT Level FROM Account WHERE Name='" + player.Name.tolower() + "'" ), 0 );
if ( lvl ) return lvl;
else return 0;
FreeSQLQuery( lvl );
}
Wanna Talk To Me? Come At Irc #Jugo@LUNet

KAKAN

I got one error:-
Error: The index 'EMessagePlayer' doesn't exist.
oh no

Thijn

And if you copy-paste this into your own script you would notice you have an else if on your first command, instead of an if.

KAKAN

Quote from: Thijn on Jan 17, 2016, 06:32 PMAnd if you copy-paste this into your own script you would notice you have an else if on your first command, instead of an if.
bugged script. In the 1st command, wtf is this?
else if (player.Level() < 7) EMessagePlayer(player,  "Command level too high");
And wtf is this:-
In the 2nd command you don't even check that if the player is spawned or not.
oh no

[VM_U]Spectra.PhantoM^

Quote from: KAKAN on Jan 17, 2016, 06:12 PMI got one error:-
Error: The index 'EMessagePlayer' doesn't exist.
Replace With MessagePlayer then easy peasy.
Quote from: KAKAN on Jan 17, 2016, 06:37 PM
Quote from: Thijn on Jan 17, 2016, 06:32 PMAnd if you copy-paste this into your own script you would notice you have an else if on your first command, instead of an if.
bugged script. In the 1st command, wtf is this?
else if (player.Level() < 7) EMessagePlayer(player,  "Command level too high");
And wtf is this:-
In the 2nd command you don't even check that if the player is spawned or not.
Sorry Thanx for noting out bug. You can replace EMessagePlayer with MessagePlayer Like this
else if (player.Level() < 7) MessagePlayer("Command level too high", player);Fixed anyways player.Level() < 7 means it cant be used by a person lower than lvl 7.
Wanna Talk To Me? Come At Irc #Jugo@LUNet

MacTavish

#5
Quote from: {ultimatejugoSorry Thanx for noting out bug. You can replace EMessagePlayer with MessagePlayer Like this
else if (player.Level() < 7) MessagePlayer("Command level too high", player);Fixed anyways player.Level() < 7 means it cant be used by a person lower than lvl 7.
It wont work because afaik Player.Level is not a Squirrel function. you better check it on Blank script before posting in VCMP community because there are many newbies those copy snippets and after getting error because of a broken script or their weak brain they start spamming the forum

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

[VM_U]Spectra.PhantoM^

Quote from: Kusanagi on Jan 17, 2016, 07:49 PM
Quote from: {ultimatejugoSorry Thanx for noting out bug. You can replace EMessagePlayer with MessagePlayer Like this
else if (player.Level() < 7) MessagePlayer("Command level too high", player);Fixed anyways player.Level() < 7 means it cant be used by a person lower than lvl 7.
It wont work because afaik Player.Level is not a Squirrel function. you better check it on Blank script before posting in VCMP community because there are many newbies those copy snippets and after getting error because of a broken script or their weak brain they start spamming the forum
Ok then simply replace with this:
plrlevel = GetLevel( nick );
else if (plrlevel > 7) MessagePlayer("Command level too high", player);
That good?
Wanna Talk To Me? Come At Irc #Jugo@LUNet

.

@{ultimatejugo] Can you show me the contents of your GetLevel() function? Me and a few guys have a curiosity about it.
.

[VM_U]Spectra.PhantoM^

Quote from: S.L.C on Jan 17, 2016, 08:26 PM@{ultimatejugo] Can you show me the contents of your GetLevel() function? Me and a few guys have a curiosity about it.
Whats there to show? anyways ill post soon in another snippet until then.
BE CURIOUS!
Wanna Talk To Me? Come At Irc #Jugo@LUNet

Anik

#9
LOL only 2 lines which is of work in the both snippet
1
plr.Eject();2
plr.Spawn();Clap Clap Clap CLap..............

EK.IceFlake

#10
You don't even use the veh variable you created in force eject. Also I noticed this is in Doomplay format, you can take the functions from there. And either you edited emessage or its plain wrong, because its not in that format. You need to have a type (Msgtype.Info, Msgtype.Command or Msgtype.Error)

[VM_U]Spectra.PhantoM^

#11
@S.L.C  I posted the function u wer curious about.
Wanna Talk To Me? Come At Irc #Jugo@LUNet

MacTavish

There is No Builtin Function that could check player level check the WIKI And you have right to slap me if i am wrong for f*** sake please check the wiki once

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

[VM_U]Spectra.PhantoM^

Quote from: Kusanagi on Jan 18, 2016, 01:36 PMThere is No Builtin Function that could check player level check the WIKI And you have right to slap me if i am wrong for f*** sake please check the wiki once
I didnt mean a builtin function anyways -_- i just posted the function and the whole thing Afaik. :P
Wanna Talk To Me? Come At Irc #Jugo@LUNet

KAKAN

Quote from: {ultimatejugo} on Jan 18, 2016, 01:41 PM
Quote from: Kusanagi on Jan 18, 2016, 01:36 PMThere is No Builtin Function that could check player level check the WIKI And you have right to slap me if i am wrong for f*** sake please check the wiki once
I didnt mean a builtin function anyways -_- i just posted the function and the whole thing Afaik. :P
the index 'db' doesn't exist
the index 'GetSQLColumnData' doesn't exist
the index 'QuerySQL' doesn't exist
Please fix them!
oh no