Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: :P on Sep 13, 2015, 05:03 PM

Title: converting and removing
Post by: :P on Sep 13, 2015, 05:03 PM
Message( "** Admin " + player.Name + " has rewarded " + mon + " for Reason " + reason );

how i can convert it to annouceall i try but cmds leaves works and no console error

and  when i type / reward nickid mon  reason
and came admin killer has rewarded to sadam 5000 for reason 500 how i can delete the 500 from message killing of sada
Title: Re: converting and removing
Post by: KAKAN on Sep 13, 2015, 05:45 PM
I can't understand what u wanted to say, except the announce all one
For the announceall, try this
AnnounceAll( "** Admin " + player.Name + " has rewarded " + mon + " for Reason " + reason, 3 );
Title: Re: converting and removing
Post by: Debian on Sep 13, 2015, 05:55 PM
Use text.slice(  ). post your cmd for more help
Title: Re: converting and removing
Post by: :P on Sep 13, 2015, 06:28 PM
not annoucing      and i sayed coming text with reson of amount i want to do not come amount with reason


and another question  how to add admin pass in server config
Title: Re: converting and removing
Post by: KAKAN on Sep 13, 2015, 06:50 PM
Quote from: xxkillerxx on Sep 13, 2015, 06:28 PMnot annoucing      and i sayed coming text with reson of amount i want to do not come amount with reason


and another question  how to add admin pass in server config

:(( Still then can't understand, GOD HELP ME!
Title: Re: converting and removing
Post by: Thijn on Sep 14, 2015, 05:45 AM
Post your code.
Title: Re: converting and removing
Post by: :P on Sep 14, 2015, 09:30 AM
how to add admin pass in server.cfg    and not announcing the message and which talk you didnt understanding watch screen shot


(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi61.tinypic.com%2Fetisjt.jpg&hash=be18a2b1f0fa0dc876ae506f475fb363b14afcae)
Title: Re: converting and removing
Post by: :P on Sep 14, 2015, 09:33 AM
removed by myself
Title: Re: converting and removing
Post by: Xmair on Sep 14, 2015, 09:49 AM
Change :
local reason = GetTok( text, " ", 2, NumTok( text, " " ) );
To :
local reason = GetTok( text, " ", 3, NumTok( text, " " ) );
Done.
Title: Re: converting and removing
Post by: :P on Sep 14, 2015, 10:54 AM
thanx xmair all prob solved but how to change message to annouceall
Title: Re: converting and removing
Post by: FinchDon on Sep 14, 2015, 11:03 AM
What Difficult??

AnnounceAll( "Your Text", 8 );
Title: Re: converting and removing
Post by: :P on Sep 14, 2015, 11:30 AM
AnnounceAll( "** Admin " + player.Name + " has rewarded " + mon + " for Reason " + reason, 3 );   finch  kakan sir give me this not works whats wrong with it
Title: Re: converting and removing
Post by: Thijn on Sep 14, 2015, 05:43 PM
Explain what's not working.
Title: Re: converting and removing
Post by: :P on Sep 16, 2015, 03:31 AM
i dont know whats not working no console error but not announcing
Title: Re: converting and removing
Post by: :P on Sep 16, 2015, 09:13 AM
is its too hard no one ables to solve???
Title: Re: converting and removing
Post by: MacTavish on Sep 16, 2015, 10:13 AM
Post your reward command then we will be able to solve it
Title: Re: converting and removing
Post by: MacTavish on Sep 16, 2015, 10:47 AM
As i wondered that you are trying to create a reward cmd but occur some problem so i decided to create it for you Try it

else if (cmd =="reward")
{
if(!text) MessagePlayer("syntax: /reward <nick/id> <amount> <reason>",player);
else
{
local plr = GetPlayer(GetTok(text, " ",1)), rew = GetTok(text, " ",2), reason = GetTok(text, " ",3 NumTok(text, " "));
if (!plr) MessagePlayer("invalid nick/id",player);
else if(!rew) MessagePlayer("Reward not specified",player);
else if(!IsNum(rew)) MessagePlayer("Reward must be integer/number",player);
else
{
if(!reason) reason = "None";
IncCash(plr, rew.tointeger());
AnnounceAll("Admin "+player.Name+" Given Reward of "+rew.tointeger()+"$ to "+plr.Name+", Reason: "+reason);
}
}
}


updated: added IncCash, added Reason
Title: Re: converting and removing
Post by: :P on Sep 16, 2015, 12:40 PM
thank you kusangi
Title: Re: converting and removing
Post by: :P on Sep 16, 2015, 12:44 PM
if you can solve this bug so will much good or not so no problem
else if ( cmd == "reward" )
{
    if ( IsNoob( player, cmd ) ) return 0;
else if ( !text ) ePrivMessage( "Syntax, /c " + cmd + " <Nick/ID> <Money> ", player );
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) ePrivMessage( "Unknown Player..", player );
else
{
   local mon = GetTok( text, " ", 2);
   if (!IsNum(mon)) ePrivMessage("Amount Must Be In Numbers..",player);
   else
   {
  Message("[#007fff]Admin [#f0e130]" + player.Name + " [#007fff]Awarded [#00ff00]" + plr.Name + "[#007fff] with: [#ff033e]" + mon + " [#007fff]c@$h.");
               IncCash( plr, mon.tointeger() );
   {
   local reason = GetTok( text, " ", 3, NumTok( text, " " ) );
   if ( reason == null ) reason = "None"
   Announce( "** Admin " + player.Name + " has rewarded " + mon + " for Reason " + reason, 3 );
}
}
}
}[code]
Title: Re: converting and removing
Post by: MacTavish on Sep 16, 2015, 12:51 PM
Quote from: xxkillerxx on Sep 16, 2015, 12:44 PMif you can solve this bug so will much good or not so no problem
else if ( cmd == "reward" )
{
    if ( IsNoob( player, cmd ) ) return 0;
else if ( !text ) ePrivMessage( "Syntax, /c " + cmd + " <Nick/ID> <Money> ", player );
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) ePrivMessage( "Unknown Player..", player );
else
{
   local mon = GetTok( text, " ", 2);
   if (!IsNum(mon)) ePrivMessage("Amount Must Be In Numbers..",player);
   else
   {
  Message("[#007fff]Admin [#f0e130]" + player.Name + " [#007fff]Awarded [#00ff00]" + plr.Name + "[#007fff] with: [#ff033e]" + mon + " [#007fff]c@$h.");
               IncCash( plr, mon.tointeger() );
   {
   local reason = GetTok( text, " ", 3, NumTok( text, " " ) );
   if ( reason == null ) reason = "None"
   Announce( "** Admin " + player.Name + " has rewarded " + mon + " for Reason " + reason, 3 );
}
}
}
}[code]

There is no bug but it would be nice if you use that i posted because that is far better than this one, i updated cmd you can copy again
Title: Re: converting and removing
Post by: :P on Sep 16, 2015, 12:58 PM
will you update your cmds to add reason please
Title: Re: converting and removing
Post by: KAKAN on Sep 16, 2015, 01:03 PM
Use this one:-
else if (cmd =="reward")
{
if(!text) MessagePlayer("syntax: /reward <nick/id> <amount>",player);
else
{
local plr = GetPlayer(GetTok(text, " ",1)), rew = GetTok(text, " ",2);
if (!plr) MessagePlayer("invalid nick/id",player);
else if(!rew) MessagePlayer("Reward not specified",player);
else if(!IsNum(rew)) MessagePlayer("Reward must be integer/number",player);
local reason = GetTok( text, " ", 3 NumTok( text, " " ) );
if(!reason) reason = "None";
else
{
IncCash(plr, rew.tointeger());
AnnounceAll("Admin "+player.Name+" Given Reward of
"+rew.tointeger()+"$ to "+plr.Name+". Reason: " + reason);
}
}
}
Title: Re: converting and removing
Post by: :P on Sep 16, 2015, 01:14 PM
error
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi61.tinypic.com%2Fj5gms3.png&hash=e687e46d1f4b07f1b2b955cc1cad3e4ed2f97ef0)
Title: Re: converting and removing
Post by: KAKAN on Sep 16, 2015, 01:20 PM
Show us the error line
Title: Re: converting and removing
Post by: :P on Sep 16, 2015, 01:22 PM
line # 84 dofile( "Cmds.nut" );
Title: Re: converting and removing
Post by: Mashreq on Sep 16, 2015, 01:22 PM
Mistakely KAKAN has pressed his enter key while typing the text of AnnounceAll which made the message to separate as 2 lines.
Change your
AnnounceAll("Admin "+player.Name+" Given Reward of
"+rew.tointeger()+"$ to "+plr.Name+". Reason: " + reason);
to
AnnounceAll("Admin "+player.Name+" Given Reward of "+rew.tointeger()+"$ to "+plr.Name+". Reason: " + reason);
Title: Re: converting and removing
Post by: . on Sep 16, 2015, 01:23 PM
const BELIEBER = "YOU NO
GET IT!";
Title: Re: converting and removing
Post by: MacTavish on Sep 16, 2015, 01:27 PM
I already update my code ;D
Title: Re: converting and removing
Post by: :P on Sep 16, 2015, 01:32 PM
thanks to mashreq    kakan  kusnangi