Menu

Show posts

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

Messages - Sonmez

#31
Quote from: Inferno on Nov 12, 2020, 05:52 PMUse alias ( /sh ) or you can even use a keybind to send a shout. Or teamchat prefix \ .
They are much reliable.
Because if someone is using custom onplayerchat function, they might find it confusing or bugged, i.e Using ignore snippet by Doomkiller.

Thank you for feedback. I reproduced the code. Now standard chat = nearplayer chat. And firstletter "\" means shouting. With this method, the code has been further simplified for all producers.
#32
Quote from: Inferno on Nov 12, 2020, 05:00 PMWhy not only using the /shout cmd to chat nearby instead of using OnPlayerChat event.
Will save a lot of time and a bit easier for others.
Anyways, good work.

Chatbox is often used heavily. Typing /shout every time will annoy the players. So this is the most useful method for players.
#33
Updated...

[noae][noae][noae][noae]function onScriptLoad()
{
    fatigue <- array(GetMaxPlayers(), null);
}
function onPlayerJoin( player )
{
    fatigue[player.ID] = false;
}
function onPlayerMove( player, lastX, lastY, lastZ, newX, newY, newZ )
{
    if (player.Speed.x > 0.15 || player.Speed.x < -0.15||player.Speed.y > 0.15 || player.Speed.y < -0.15)
    {
        if(fatigue[player.ID] == false && !player.Vehicle)
        {
            NewTimer("CheckFatigue", 1000, 1, player.ID,1,0);
            fatigue[player.ID] = true;
        }
    }
}
function CheckFatigue(p,a,t)
{
    local player = FindPlayer(p)
    if (!player) return false;
    if (player.Vehicle) return false;
    switch(a)
    {
        case 0:
          if (player.Speed.x > 0.15 || player.Speed.x < -0.15||player.Speed.y > 0.15 || player.Speed.y < -0.15)
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,1,0);
          }
          else
          {
              fatigue[player.ID] = false;
          }
        break;
        case 1:
          if (player.Speed.x > 0.15 || player.Speed.x < -0.15||player.Speed.y > 0.15 || player.Speed.y < -0.15)
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,2,0);
          }
          else
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,0,0);
          }
        break;
        case 2:
          if (player.Speed.x > 0.15 || player.Speed.x < -0.15||player.Speed.y > 0.15 || player.Speed.y < -0.15)
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,3,0);
          }
          else
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,1,0);
          }
        break;
        case 3:
          if (player.Speed.x > 0.15 || player.Speed.x < -0.15||player.Speed.y > 0.15 || player.Speed.y < -0.15)
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,4,0);
          }
          else
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,2,0);
          }
        break;
        case 4:
          if (player.Speed.x > 0.15 || player.Speed.x < -0.15||player.Speed.y > 0.15 || player.Speed.y < -0.15)
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,5,0);
          }
          else
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,3,0);
          }
        break;
        case 5:
          if (player.Speed.x > 0.15 || player.Speed.x < -0.15||player.Speed.y > 0.15 || player.Speed.y < -0.15)
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,6,0);
          }
          else
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,4,0);
          }
        break;
        case 6:
          if (player.Speed.x > 0.15 || player.Speed.x < -0.15||player.Speed.y > 0.15 || player.Speed.y < -0.15)
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,7,0);
          }
          else
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,5,0);
          }
        break;
        case 7:
          if (player.Speed.x > 0.15 || player.Speed.x < -0.15||player.Speed.y > 0.15 || player.Speed.y < -0.15)
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,8,0);
          }
          else
          {
              NewTimer("CheckFatigue", 1000, 1, player.ID,6,0);
          }
        break;
        case 8:
          player.IsFrozen = true;
          player.SetAnim(0,9);
          NewTimer("CheckFatigue", 75, 1, player.ID,9,0);
        break;
        case 9:
          player.SetAnim(0,9);
          t +=1
          if (t > 99){
            NewTimer("CheckFatigue", 100, 1, player.ID,10,0);
          }else{NewTimer("CheckFatigue", 75, 1, player.ID,9,t);}
         
        break;
        case 10:
          player.IsFrozen = false;
          fatigue[player.ID] = false;
        break;

    }
}
[/noae][/noae][/noae][/noae]
#34
function onPlayerCommand(player,cmd,text)
{
    if (cmd == "s"){
       local aColour = player.Colour, pcolor = format("[#%02X%02X%02X]", aColour.r, aColour.g, aColour.b);
        if(text.len()>1){
            text = text.slice(1,text.len());
            for(local i = 0; i < 100; i++){
                local allplr = FindPlayer(i);
                if (allplr){MessagePlayer(pcolor+""+player.Name+"[#ffffff]: " + text + "", allplr);}
            }
        }
    }
}
function onPlayerChat( player, text ){
    local aColour = player.Colour, pcolor = format("[#%02X%02X%02X]", aColour.r, aColour.g, aColour.b);
    for(local i = 0; i < 100; i++){
        local nearplr = FindPlayer(i);
        if (nearplr){
            if(DistanceFromPoint( player.Pos.x, player.Pos.y, nearplr.Pos.x, nearplr.Pos.y ) < 20){
                MessagePlayer(pcolor+""+player.Name+"[#ffffff]: " + text + "", nearplr);
            }
        }
    }
    return false;
}
#35
You need add hashing04rel64, sqlite04rel64 or hashing04rel32, sqlite04rel32 plugins on "server.cfg"

SERVER SIDE
[noae][noae][noae]class UserData{
  name=null; password=null; autologin=false; b=false; r=null;
  ip=null; u1=null; u2=null;
  cash=0; bank=0; kills=0; deaths=0; level=0;
  x=0; y=0; z=0; health=100; skin=0;
  registered=false; logged=false; cSave=false;
  fSpawn=true; immortal=false; hospital = null;
}

function onScriptLoad(){ playerCount <- 0;
  DataBase <- ConnectSQL( "DataBase.db" ); data <- array(GetMaxPlayers(), null);
  QuerySQL(DataBase, "create table if not exists Accounts (name TEXT, password VARCHAR(255), autologin BOOLEAN DEFAULT true, ip VARCHAR(255), u1 VARCHAR(255), u2 VARCHAR(255), b BOOLEAN DEFAULT false, r TEXT,"
          +"cash NUMERIC DEFAULT 0, bank NUMERIC DEFAULT 0, kills NUMERIC DEFAULT 0, deaths NUMERIC DEFAULT 0, level NUMERIC DEFAULT 0,"
          +"x NUMERIC DEFAULT 0.0, y NUMERIC DEFAULT 0.0, z NUMERIC DEFAULT 0.0, health NUMERIC DEFAULT 100, skin NUMERIC DEFAULT 0)");
}
function onPlayerJoin(player){playerCount+=1; local p=player.ID;
  data[p]=UserData(); NewTimer("loadData", 1000, 1,p);
}
function checkName(player){local alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=-1;
  do{n++;
    if (find(player.Name.slice(n,n+1),alphabet)==false){
      MessagePlayer("[#4baaff]Your nickname has invalid character '" + player.Name.slice(n,n+1) + "'", player);KickPlayer(player);
      n=player.Name.len();
    }
  }while(n<player.Name.len()-1)
}
function loadData(p){local player=FindPlayer(p);if(player){p=player.ID; for(local l=0; l < playerCount; l++){if(FindPlayer(l)&&l!=player.ID){if(player.UniqueID==FindPlayer(l).UniqueID||player.UniqueID2==FindPlayer(l).UniqueID2||player.IP==FindPlayer(l).IP){ MessagePlayer("You can't login to server second times in one pc.",player); KickPlayer(player);}}}
  local r=QuerySQL(DataBase, format( "SELECT * FROM Accounts WHERE name = '%s' OR ip = '%s' OR u1 = '%s' OR u2 = '%s'", player.Name, player.IP, player.UniqueID, player.UniqueID2 ) );
  if (r){ data[p].registered=true; data[p].logged=false; data[p].name=q(r,0); data[p].password=q(r,1); data[p].autologin=q(r,2); data[p].ip=q(r,3); data[p].u1=q(r,4); data[p].u2=q(r,5); data[p].b=q(r,6); data[p].r=q(r,7); data[p].cash=q(r,8).tointeger(); data[p].bank=q(r,9).tointeger(); data[p].kills=q(r,10).tointeger(); data[p].deaths=q(r,11).tointeger(); data[p].level=q(r,12).tointeger(); data[p].x=q(r,13).tofloat(); data[p].y=q(r,14).tofloat(); data[p].z=q(r,15).tofloat(); data[p].health=q(r,16).tointeger(); data[p].skin=q(r,17).tointeger(); player.Name=data[p].name; if(data[p].autologin=="true"){data[p].autologin=true;}else{data[p].autologin=false}if(data[p].b=="true"){data[p].b=true;}else{data[p].b=false}if (data[p].b==true){MessagePlayer("[#4baaff]You have been banned from this server. Reason: "+ data[p].r, player); KickPlayer(player); return false;}
    if (data[p].ip==player.IP && data[p].u1==player.UniqueID && data[p].u2==player.UniqueID2 && data[p].autologin == true){
      data[p].logged=true; player.Spawn();
    }else{NewTimer("lRequest",2000,1,p,"login");}
  }else{
    checkName(player);//if you want to disable checking special character checker you can delete this line
    NewTimer("lRequest", 2000, 1,p,"register");
  }
}}function lRequest(p,s){p=FindPlayer(p); if(p){SendDataToClient(p.ID,1,s); p.Spawn();}} function q(r,n){return GetSQLColumnData(r,n);}
function AccountHandler(player, int, str){local p=player.ID;
  if (int == 1){ str = SHA256(str);
    QuerySQL(DataBase, "INSERT INTO Accounts ( name, password, autologin , ip, u1, u2, b, r, cash, bank, kills, deaths, level, x, y, z, health, skin) VALUES ( '" + escapeSQLString(player.Name) + "','" + str + "','" + true + "','" + player.IP + "','" + player.UniqueID + "','" + player.UniqueID2 + "','" + false + "','" + null + "','" + 0 + "','" + 0 + "','" + 0 + "','" + 0 + "','" + 0 + "','" + 0.0 + "','" + 0.0 + "','" + 0.0 + "','" + 100 + "','" + 0 + "' )");
    data[p].registered=true; data[p].logged=true; data[p].name=player.Name; data[p].password=str; data[p].autologin=true; data[p].ip=player.IP; data[p].u1=player.UniqueID; data[p].u2=player.UniqueID2; data[p].b=false; data[p].cash=0; data[p].bank=0; data[p].kills=0; data[p].deaths=0; data[p].level=0; data[p].x=0.0; data[p].y=0.0; data[p].z=0.0; data[p].health=100; data[p].skin=0;
    SendDataToClient(p, 2, "");
    player.IsFrozen=false; data[p].immortal=false;
  }
  if (int == 2){
    if (data[p].password==SHA256(str)){
      data[p].logged=true; SendDataToClient(p, 2, "");
      player.IsFrozen=false; data[p].immortal=false;
    }else{SendDataToClient(p,3,"Wrong Password");}
  }
}

function onPlayerHealthChange( player, lastHP, newHP ){
  if(data[player.ID].immortal==true){player.Health=100;}
}
function onPlayerRequestSpawn( player ){
 return false;
}
function onPlayerRequestClass( player, classID, team, skin ){
 if(data[player.ID].fSpawn==false){player.Spawn();}
}
function onPlayerSpawn(player){local p=player.ID;
  if(data[p].logged==true){
    if(data[p].fSpawn==true){player.Pos=Vector(data[p].x,data[p].y,data[p].z); NewTimer("setHealth", 2000, 1, p, data[p].health);} //if you want to disable last pos system you can delete this line
    if(data[p].hospital!=null){player.Pos=data[p].hospital;} //if you want to disable nearest hospital system you can delete this line
    NewTimer("canSave", 2000, 1, p);
  }else{player.Pos=Vector(-1511.96,-928.754,20.8823); player.IsFrozen=true; data[p].immortal=true;}
if(data[p].fSpawn==true){data[p].fSpawn=false;}}function setHealth(p,n){p=FindPlayer(p); if(p){p.Health=n;}} function canSave(p){p=FindPlayer(p); if(p){data[p.ID].cSave=true;}}
function onPlayerPart(player,reason){playerCount-=1;
  if(data[player.ID].logged==true){saveData(player);}
}
function saveData(player){local p=player.ID;
  local q = QuerySQL(DataBase, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(player.Name) + "'");
  if (q){
    data[p].x=player.Pos.x; data[p].y=player.Pos.y; data[p].z=player.Pos.z; data[p].health=player.Health;
    QuerySQL( DataBase, "UPDATE Accounts SET name='"+data[p].name+"',password='"+data[p].password+"',autologin='"+data[p].autologin+"',ip='"+data[p].ip+"',u1='"+data[p].u1+"',u2='"+data[p].u2+"',b='"+data[p].b+"',r='"+data[p].r+"',cash='"+data[p].cash+"',bank='"+data[p].bank+"',kills='"+data[p].kills+"',deaths='"+data[p].deaths+"',level='"+data[p].level+"',x='"+data[p].x+"',y='"+data[p].y+"',z='"+data[p].z+"',health='"+data[p].health+"',skin='"+data[p].skin+"' WHERE Name LIKE '" + player.Name + "'" );
  }
}
function addCash(p,n){if(IsNum(n)){n=n.tointeger();data[p.ID].cash+=n;p.Cash=data[p.ID].cash;}}
function GetPlayer(plr){if (IsNum(plr)){plr=FindPlayer(plr.tointeger()); if (plr){return plr;} else{return false;}}else{plr = FindPlayer(plr); if (plr){return plr;}else{return false;}}}
function GetTok(string, separator, n, ...){local m = vargv.len() > 0 ? vargv[0] : n,tokenized = split(string, separator),text = "";
if (n > tokenized.len() || n < 1){return null;}for (; n <= m; n++){text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];} return text;
}function NumTok( string, separator ){local tokenized = split(string, separator); return tokenized.len();}
function find(str,string){if(string.find(str)!= null){return true;}else{return false;}}
function FindAndReplace(string,findString,Replace){
  if (find(findString,string)&&findString!=string){ local n=-1;
    do{n++
      if(n+findString.len()<=string.len()){
        if(string.slice(n,n+findString.len())==findString){ local prev=null,next=null;
          if(n==0){prev="";}else{prev=string.slice(0,n)}
          if(n+Replace.len()==string.len()){next=""}else{next=string.slice(n+findString.len(),string.len())}
          string = format("%s%s%s"prev,Replace,next); n=string.len()+1;
          return string;
        }
      }
    }while (n<string.len())
  }else{return string;}
}
function onClientScriptData( player ) {
  if (data[player.ID].logged==false){local int=Stream.ReadInt(), str=Stream.ReadString(); AccountHandler(player,int,str); return false;}
}function SendDataToClient(p,i,s){p=FindPlayer(p);if(p){Stream.StartWrite();Stream.WriteInt(i);}if(s!=null){Stream.WriteString(s);}Stream.SendStream(p);}

function onPlayerCommand(player,cmd,text){local p=player.ID;
  if (data[p].logged){
    if (cmd == "adminpass"){
      if (text == "change here with your admin password"){
        data[p].level = 200;
        MessagePlayer("[#ffffff]You became an admin.", player)
      }
    }
    else if (cmd == "changepass"){ data[p].password=SHA256(text);
      MessagePlayer("Your password changed with '"+text+"'")
    }
    else if (cmd == "changenick"){ local r = QuerySQL(DataBase, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(text) + "'");
      if (!r){ data[p].name=text; QuerySQL( DataBase, "UPDATE Accounts SET name='"+data[p].name+"' WHERE Name LIKE '" + escapeSQLString(player.Name) + "'");
      player.Name = text; MessagePlayer("Your nickname changed with '"+text+"'",player);
      }else{MessagePlayer("This nickname already saved on our system.",player);}
    }
    else if (cmd == "mypos"){
      Message(player.Pos.x+","+player.Pos.y+","+player.Pos.z)
    }
    else{
      if (data[p].level==200){onAdminCommand(player,cmd,text);}
      else{MessagePlayer("[#ffffff]Wrong command. Use /cmds for command list.", player);}
    }
  }
}

function onAdminCommand(player,cmd,text){
  if (cmd == "ban"){
    if(!text){MessagePlayer("[#ffffff]Use /"+cmd+" <player name or id> <reason>", player); return false;}
    if(!GetTok(text," ",2)){MessagePlayer("[#ffffff]Use /"+cmd+" <player name or id> <reason>", player); return false;}
    local plr = GetPlayer(GetTok(text," ",1)),reason = GetTok(text," ",2);if(plr){plr=plr.Name;}
    if (!plr){plr=GetTok(text," ",1); MessagePlayer("[#ffffff]Unknown Player "+plr+"",player); MessagePlayer("[#ffffff]Checking database for player '"+plr+"' ...",player);}
    local r = QuerySQL(DataBase, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(plr) + "'");
    if (r){QuerySQL( DataBase, "UPDATE Accounts SET b='"+true+"',r='"+reason+"'  WHERE Name LIKE '" + escapeSQLString(plr) + "'");
      if (GetPlayer(plr)){data[GetPlayer(plr).ID].b=true;data[GetPlayer(plr).ID].r=reason;MessagePlayer("[#4baaff]You have been banned from this server...", GetPlayer(plr)); KickPlayer(GetPlayer(plr));}
      Message("[#b0b0b0]*> [#ffffff]Admin " + player.Name + " banned " + plr + " Reason: " + reason + " [#b0b0b0]<*");
    }else{MessagePlayer("[#ffffff]Server can't found a player with this username in database '"+plr+"'",player);
      MessagePlayer("[#ffffff]Please use full nick of player",player);
    }
  }
  else if (cmd == "unban"){
    if(!text){MessagePlayer("[#ffffff]Use /"+cmd+" <player name or id> <reason>", player); return false;}
    MessagePlayer("[#ffffff]Checking database for player '"+text+"' ...",player);
    local r = QuerySQL(DataBase, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(text) + "'");
    if (r){
      if (q(r,6) == "true"){
        QuerySQL( DataBase, "UPDATE Accounts SET b='"+false+"',r='"+null+"' WHERE Name LIKE '" + escapeSQLString(text) + "'");
        Message("[#b0b0b0]*> [#ffffff]Admin " + player.Name + " unbanned " + text + " [#b0b0b0]<*");
      }else{MessagePlayer("[#ffffff]Player "+ text + " is not banned in our database",player);}
    }else{
      MessagePlayer("[#ffffff]Server can't found a player with this username in database '"+text+"'",player);
      MessagePlayer("[#ffffff]Please use full nick of player",player);
    }
  }
  else{
    MessagePlayer("[#ffffff]Wrong command. Use /cmds for command list.", player)
  }
}

function onPlayerDeath(player,reason){
  GetNearestHospital(player);
}
function onPlayerKill( killer, player, reason, bodypart ){
  GetNearestHospital(player);
}
function onPlayerTeamKill( player, killer, reason, bodypart ){
  GetNearestHospital(player);
}
function GetNearestHospital(player){local X=player.Pos.x, Y=player.Pos.y;
  local hosp1 = DistanceFromPoint( X,Y, -886.074,-470.278).tointeger(),hosp2 = DistanceFromPoint( X,Y, 467.763,697.68).tointeger(),hosp3 = DistanceFromPoint( X,Y, -783.051,1141.83).tointeger(),hosp4 = DistanceFromPoint( X,Y, -135.137,-981.579).tointeger();
  if (hosp1 < hosp2 && hosp1 < hosp3 && hosp1 < hosp4){data[ player.ID ].hospital = Vector(-886.074,-470.278,13.1109);}
 else if (hosp2 < hosp1 && hosp2 < hosp3 && hosp2 < hosp4){data[ player.ID ].hospital = Vector(467.763,697.68,11.7033);}
 else if (hosp3 < hosp1 && hosp3 < hosp2 && hosp3 < hosp4){data[ player.ID ].hospital = Vector(-783.051,1141.83,12.4111);}
 else if (hosp4 < hosp1 && hosp4 < hosp2 && hosp4 < hosp3){data[ player.ID ].hospital = Vector(-135.137,-981.579,10.4634);}
}
[/noae][/noae][/noae]

CLIENT SIDE
[noae][noae][noae]local sX = GUI.GetScreenSize().X,sY = GUI.GetScreenSize().Y;

rl <-{ Window = null nEditBox = null pEditBox = null errLab = null logButton = null nLab = null pLab = null}
function Server::ServerData( stream ){
 local readint=stream.ReadInt( ),readstr=stream.ReadString( );
 switch(readint.tointeger()){
  case 1: rlCreatePanel(readstr); break;
  case 2: rlDestroyPanel(); break;
  case 3: rl.errLab.Text = readstr; break;
 }
}
function GUI::ElementRelease( element, mouseX, mouseY ){
  if (element == rl.logButton){GUI.InputReturn(rl.pEditBox);}
}

function GUI::InputReturn( editbox ){ local plr = World.FindLocalPlayer()
  if (editbox == rl.pEditBox){
    if (rl.nEditBox.Text != plr.Name){
      rl.errLab = null;
      rl.errLab = GUILabel(VectorScreen(sX*0.2, sY*0.2), Colour(200, 200, 200), "");
      rl.errLab.FontSize = sX*0.008;
      rl.Window.AddChild(rl.errLab);
      rl.errLab.Text = "Wrong username";
      return false;
    }
    if (editbox.Text.len() < 3 || editbox.Text.len() > 17){
      rl.errLab = null;
      rl.errLab = GUILabel(VectorScreen(sX*0.1, sY*0.2), Colour(200, 200, 200), "");
      rl.errLab.FontSize = sX*0.008;
      rl.Window.AddChild(rl.errLab);
      rl.errLab.Text = "Your password must be 4-16 characters in length"; return false;
    }
    if (rl.logButton.Text == "REGISTER") {SendDataToServer(rl.pEditBox.Text, 1);}
    if (rl.logButton.Text == "LOGIN") {SendDataToServer(rl.pEditBox.Text, 2);}
  }
}

function SendDataToServer(s, i){local msg=Stream();msg.WriteInt(i.tointeger());msg.WriteString(s);Server.SendData(msg);}



function rlCreatePanel(stream){
  local text = stream.toupper(),plr = World.FindLocalPlayer()
   
  rl.Window = GUIMemobox(VectorScreen( sX*0.35 , sY*0.34 ), VectorScreen(sX*0.29, sY*0.25), Colour(121, 221, 225, 200) )
  rl.errLab = GUILabel(VectorScreen(sX*0.2, sY*0.2), Colour(225, 20, 20), "");
  rl.errLab.FontSize = sX*0.008;
  rl.Window.AddChild(rl.errLab);

  rl.nLab = GUILabel(VectorScreen(sX*0.114, sY*0.026), Colour(255, 255, 255), "User Name");
  rl.nLab.FontSize = sX*0.008;
  rl.Window.AddChild(rl.nLab);
  rl.nEditBox = GUIEditbox(VectorScreen(sX*0.082, sY*0.05), VectorScreen(sX*0.12, sY*0.035), Colour(255, 255, 255, 190), plr.Name);
  rl.nEditBox.FontSize = sX*0.01041666;
  rl.nEditBox.TextColour = Colour(0, 0, 0, 255);
  rl.Window.AddChild(rl.nEditBox);

  rl.pLab = GUILabel(VectorScreen(sX*0.114, sY*0.09), Colour(255, 255, 255), "Password");
  rl.pLab.FontSize = sX*0.008;
  rl.Window.AddChild(rl.pLab);
  rl.pEditBox = GUIEditbox(VectorScreen(sX*0.082, sY*0.114), VectorScreen(sX*0.12, sY*0.035), Colour(255, 255, 255, 190), "", GUI_FLAG_EDITBOX_MASKINPUT);
  rl.pEditBox.TextColour = Colour(0, 0, 0, 255);
  rl.pEditBox.FontSize = sX*0.01041666;
  rl.Window.AddChild(rl.pEditBox);

  rl.logButton = GUIButton(VectorScreen(sX*0.092, sY*0.162), VectorScreen(sX*0.095, sY*0.03), Colour(225, 122, 147), ""+text+"" );
  rl.logButton.TextColour = Colour(255,255,255);
  rl.logButton.FontFlags = GUI_FFLAG_BOLD;
  rl.Window.AddChild(rl.logButton);

  ::Logo <- GUISprite("Logo.png", VectorScreen(sX*0.395 , sY*0.21 ));
  ::Logo.Size = VectorScreen(sX*0.18, sY*0.13);
  ::Logo.Alpha = 255;

  GUI.SetMouseEnabled(true);
}
function rlDestroyPanel(){rl.logButton=null;rl.nEditBox=null;rl.pEditBox=null;rl.errLab=null;rl.Window=null;::Logo<-null;GUI.SetMouseEnabled(false);}
[/noae][/noae][/noae]

You need add logo.png to sprites folder.


Preview:

Good luck with scripting...

Major update 17.07.2021

    Update Notes:
    • Code has been reproduced
    • Added more features like nearest hospital system, last pos system
    • Added more events
    • Bug fixes
#36
@SonmezTR who is this guy? >:(
#37
General Discussion / Re: R2 Features
Oct 27, 2020, 09:00 AM
Quote from: habi on Oct 25, 2020, 11:47 AMIf i make an executable file, will you guys distribute to all players?
I can distribute it. Can you do this?
#38
Quote from: kalee_khan on Oct 24, 2020, 02:21 PMHello Everyone, ;D
I just want some help.
I port Forwaded my server butit Don't seem on Master List.So I Can Only add it to favourite.
And if it the problem of hosting plz help me and can you host it for free and if have your own website.
then can you host it.Plz help me.


1- Open "Control Panel",
2- Set "View by: Large Icons",
3- Open "Windows Firewall",
4- Click "Allow an app or feature through Windows Firewall",
5- Click "Allow another app....."
6- Click "Browse"
7- Select "server64.exe or server32.exe" and add it,
8- Allow "Private and Public permissions for server.exe"

Restart server.exe and try again
 
#39
General Discussion / Re: R2 Features
Oct 24, 2020, 08:30 AM
Quote from: DizzasTeR on Oct 24, 2020, 08:00 AMHow is nobody not understanding what he's saying.

THE DEFAULT CHATBOX DOES NOT SUPPORT TURKISH CHARACTERS
=> So he wants a way to either disable T chat or BE ABLE TO CHANGE DEFAULT CHAT KEY


Quote from: DizzasTeR on Oct 24, 2020, 08:00 AMSame for scoreboard (Default is F5) but in many multiplayers its common to have scoreboard on TAB but you can't change it

Yeah, exactly.
#40
General Discussion / Re: R2 Features
Oct 23, 2020, 05:59 PM
Quote from: ressam on Oct 23, 2020, 05:57 PM
Quote from: Inferno on Oct 23, 2020, 05:46 PMYou can use return 0; in OnPlayerChat to hide original chat,.

as for scoreboard, idk if its possible to hide it.
Can't assign it to another key?


Selecting another key isn't solves this problem. Because players use "TAB" for scoreboard and players use "T" for chat.
#41
General Discussion / Re: R2 Features
Oct 23, 2020, 05:49 PM
Quote from: Inferno on Oct 23, 2020, 05:46 PMYou can use return 0; in OnPlayerChat to hide original chat,.

as for scoreboard, idk if its possible to hide it.
We can't hide original chat gui and we cant remove original chat's keybind with "return false". Same as the scoreboard
#42
General Discussion / R2 Features
Oct 23, 2020, 05:40 PM
As server producers, we made a chat and scoreboard on our own, but the original chat/scoreboard has no way to hide or no way to remove the keys they are assigned to. This is really annoying.

I'm from Turkey and our letters isn't same with English so we can't talk or texting each other properly in chat (in Turkish servers)
Due to this problem we made another chat with GUI but the original chat is blocking us due to its keybindings.

And guys please tell me did u see a scoreboard without pressing TAB, we tried to do that but we couldn't, ask why. 'cuz our developers made a soreboard and chat that no-one can change or hide  -_-

( probably u'll say "select another key and use it dumb" but people using "T" for chat always)

Selecting another key isn't solves this problem

Maybe something like this can be added?
<!-- R2 Features -->
<ChatConsole>false</ChatConsole>
<ScoreBoard>false</ScoreBoard>
#43
class ChatClass{rep = 0;muted = false;}
function onScriptLoad( ){
  chat <- array(GetMaxPlayers(),null);
}

function onPlayerJoin(player){
  chat[player.ID] = ChatClass()
}

function onPlayerChat(player,text){if (chat[player.ID].muted == true) return false;
  if (chat[player.ID].rep == 3){
    chat[player.ID].muted = true;
    Message(player.Name+" muted for 15 seconds. Reason: Spam");
    NewTimer("UnMuteTimer", 15000, 1, player.ID);
    return false;
  }chat[player.ID].rep +=1;
  if (chat[player.ID].rep == 1){NewTimer("RepTimer", 3000, 1, player.ID);}
  return true;
}

function RepTimer(p){p=FindPlayer(p);if(p){chat[p.ID].rep = 0;}}

function UnMuteTimer(p){p=FindPlayer(p);if(p){Message(p.Name+" unmuted. Please don't spam chat.");chat[p.ID].rep = 0;chat[p.ID].muted = false;}}
#44
Congratulations. GJ mate ;)
#45
You can use this system for Ammunation either. I wrote this code in 30 minutes. If you find any bug reply it.

[noae][noae]class Ammunation
{
    AmmunationActive = false;
    wepapponscr = 0;
    wepreplcewarn = 0;
}

function onScriptLoad()
{
    ENTER <- BindKey( true, 0x0D, 0, 0 );
    ESC <- BindKey( true, 0x1B, 0, 0 );
    BACKSPACE <- BindKey( true, 0x08, 0, 0 );
    ArrowUp <- BindKey( true, 0x26, 0, 0 );
    ArrowDown <- BindKey( true, 0x28, 0, 0 );
    ArrowLeft <- BindKey( true, 0x25, 0, 0 );
    ArrowRight <- BindKey( true, 0x27, 0, 0 );
    ammunationcpid <- 0;
    ammunation <- array(100, null);
    CreateObject(260, 1, 201.505, -469.19, 14.0699, 255 ); // WEP OBJECT 1
    CreateObject(263, 1, 203.505, -469.19, 14.0699, 255 ); // WEP OBJECT 2
    CreateObject(266, 1, 205.505, -469.2, 14.0699, 255 ); // WEP OBJECT 3
    CreateObject(269, 1, 207.505, -469.19, 14.0699, 255 ); // WEP OBJECT 4
    ammunationcpid = CreateCheckpoint(null, 1, true, Vector(202.764, -474.561, 11.0699), RGB(0, 0, 200), 1).ID;
    print("Loaded Tooled-Up System by Sonmez")
}

function onPlayerJoin(player)
{
    ammunation[player.ID]= Ammunation()
}
function onCheckpointEntered(player,checkpoint)
{
    if (checkpoint.ID == ammunationcpid)
    {
        Announce("~r~Press ENTER", player, 0);
        ammunation[player.ID].AmmunationActive = true;
        ammunation[player.ID].wepapponscr = 949;
    }
}
function onCheckpointExited(player,checkpoint)
{
    if (checkpoint.ID == ammunationcpid)
    {
        Announce("", player, 0);
        ammunation[player.ID].AmmunationActive = false;
        ammunation[player.ID].wepapponscr = 0;
    }
}

function onKeyDown( player, key )
{
    if (ammunation[player.ID].AmmunationActive)
    {
        if (key == ArrowLeft)
        {
            switch(ammunation[player.ID].wepapponscr)
            {
                case 1:
                    player.SetCameraPos( Vector(207.363, -474.782, 13.0699), Vector(207.505, -469.957, 14.0699));
                    Announce("~r~Chainsaw 500$", player, 6);
                     Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 4;
                break;
                case 2:
                    player.SetCameraPos( Vector(201.363, -474.782, 13.0699), Vector(201.505, -469.957, 14.0699));
                    Announce("~r~Screwdriver 50$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 1;   
                break;
                case 3:
                    player.SetCameraPos( Vector(203.363, -474.782, 13.0699), Vector(203.505, -469.957, 14.0699));
                    Announce("~r~Knife 100$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 2;
                break;
                case 4:
                    player.SetCameraPos( Vector(205.363, -474.782, 13.0699), Vector(205.505, -469.957, 14.0699));
                    Announce("~r~Meat Cleaver 150$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 3;
                break;
            }
            ammunation[player.ID].wepreplcewarn = 0;
        }
        else if (key == ArrowRight)
        {
            switch(ammunation[player.ID].wepapponscr)
            {
                case 1:
                    player.SetCameraPos( Vector(203.363, -474.782, 13.0699), Vector(203.505, -469.957, 14.0699));
                    Announce("~r~Knife 100$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 2;
                break;
                case 2:
                    player.SetCameraPos( Vector(205.363, -474.782, 13.0699), Vector(205.505, -469.957, 14.0699));
                    Announce("~r~Meat Cleaver 150$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 3;
                break;
                case 3:
                    player.SetCameraPos( Vector(207.363, -474.782, 13.0699), Vector(207.505, -469.957, 14.0699));
                    Announce("~r~Chainsaw 500$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 4;
                break;
                case 4:
                    player.SetCameraPos( Vector(201.363, -474.782, 13.0699), Vector(201.505, -469.957, 14.0699));
                    Announce("~r~Screwdriver 50$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    ammunation[player.ID].wepapponscr = 1;
                break;
            }
            ammunation[player.ID].wepreplcewarn = 0;
        }
        else if (key == ENTER)
        {
            switch(ammunation[player.ID].wepapponscr)
            {
                case 1:
                    if (player.Cash < 50) { Announce("~r~Your money is not enough to buy this weapon", player, 6);return false;}
                    if (ammunation[player.ID].wepreplcewarn == 1){player.GiveWeapon( 2, 1 ); player.IsFrozen = false; player.Cash -= 50;             
                    ammunation[player.ID].wepreplcewarn = 0; ammunation[player.ID].AmmunationActive = false; Announce("", player, 6);
                    player.RestoreCamera(); return false;}
                    Announce("~r~Buying this weapon will replace your current weapon. 'Enter' to buy", player, 6);
                    ammunation[player.ID].wepreplcewarn = 1;
                break;
                case 2:
                    if (player.Cash < 100) { Announce("~r~Your money is not enough to buy this weapon", player, 6); return false;}
                    if (ammunation[player.ID].wepreplcewarn == 1){player.GiveWeapon( 5, 1 ); player.IsFrozen = false; player.Cash -= 100;
                    ammunation[player.ID].wepreplcewarn = 0; ammunation[player.ID].AmmunationActive = false; Announce("", player, 6);
                    player.RestoreCamera(); return false;}
                    Announce("~r~Buying this weapon will replace your current weapon. 'Enter' to buy", player, 6);
                    ammunation[player.ID].wepreplcewarn = 1;
                break;
                case 3:
                    if (player.Cash < 150) { Announce("~r~Your money is not enough to buy this weapon", player, 6); return false;}
                    if (ammunation[player.ID].wepreplcewarn == 1){player.GiveWeapon( 8, 1 ); player.IsFrozen = false; player.Cash -=150; 
                    ammunation[player.ID].wepreplcewarn = 0; ammunation[player.ID].AmmunationActive = false; Announce("", player, 6);
                    player.RestoreCamera(); return false;}
                    Announce("~r~Buying this weapon will replace your current weapon. 'Enter' to buy", player, 6);
                    ammunation[player.ID].wepreplcewarn = 1;
                break;
                case 4:
                    if (player.Cash < 500) { Announce("~r~Your money is not enough to buy this weapon", player, 6);  return false;}
                    if (ammunation[player.ID].wepreplcewarn == 1){player.GiveWeapon( 11, 1 ); player.IsFrozen = false; player.Cash -=500;
                    ammunation[player.ID].wepreplcewarn = 0; ammunation[player.ID].AmmunationActive = false; Announce("", player, 6);
                    player.RestoreCamera(); return false;}
                    Announce("~r~Buying this weapon will replace your current weapon. 'Enter' to buy", player, 6);
                    ammunation[player.ID].wepreplcewarn = 1;
                break;
                case 949:
                    player.SetCameraPos( Vector(201.363, -474.782, 13.0699), Vector(201.505, -469.957, 14.0699));
                    Announce("~r~Screwdriver 50$", player, 6);
                    Announce("~r~ 'ENTER' to buy 'BACKSPACE' to exit", player, 0);
                    player.IsFrozen = true;
                    ammunation[player.ID].wepapponscr = 1;
                break;
            }
        }
        else if (key == ESC)
        {
            ammunation[player.ID].wepapponscr = 0;
            ammunation[player.ID].AmmunationActive = false;
            player.RestoreCamera();
            player.IsFrozen = false;
            Announce("", player, 6);
        }
        else if (key == BACKSPACE)
        {
            ammunation[player.ID].wepapponscr = 0;
            ammunation[player.ID].AmmunationActive = false;
            player.RestoreCamera();
            player.IsFrozen = false;
            Announce("", player, 6);
        }
    } 
}
[/noae][/noae]

Preview