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
Pages: [1]
1  Scripting / Script Help / Re: Problem with Updater.exe on: July 24, 2017, 10:33:49 pm
I think what worked for me is to connect with 1.0.17 client to 1.0.16 server. Of course it will notify about version mismatch, but then, after a while, server will be executing update itself. Try that.
2  Scripting / Script Help / Re: NewTimer - wrong number of parameters on: July 06, 2017, 12:29:54 am
Ok so the problem was with passing class instance member to function invoked in timer. I resolved it by passing teamId and increasing red or blue team score based on that.

Doppelherz and mega mind : no really need for offensive behavior like that. Stay cool ;).

3  Scripting / Script Help / NewTimer - wrong number of parameters on: June 29, 2017, 01:08:08 am
Hi,
for last few days I've been struggling with calling my function through NewTimer. In the result server throws the following error message : "An error has occured [wrong number of parameters]
CALLSTACK
LOCALS".

Looks like my passed argument  'playerTeam' is treated as null (its instance of DominationTeam class), however printing 'playerTeam.Score' outside of timer shows that there is value indeed.

I tried also to pass just simply number and increase it. In that case there is no error like that, but I guess the variable is passed by value so only copy of it is taken to the function (it prints 1 at every timer tick).

Another way I tried is to create score variable with bigger scope than just function. In this solution no error is thrown, but Message(score) called after incrementing the score value showed nothing. 

I really don't have idea what Im doing wrong, so an help will be greatly appreciated ;).

Below I put the code, onPlayerEnterCheckpoint method  is the place where issue happens.

Code: [Select]
   
    local RED = Colour(255,0,0);
    local BLUE = Colour(0,0,255);
    local WHITE = Colour(255,255,255);
//
class DominationTeam
{
      Name = null;
TeamColour = WHITE;
Score = 0;
   constructor(colorOfTheTeam)
   {
Score = 0;
if(colorOfTheTeam == RED || colorOfTheTeam == BLUE)
TeamColour = colorOfTheTeam ;
Name = colorOfTheTeam == RED ? "Red" : "Blue";
   }
}
//
local redTeam = DominationTeam(RED);
local blueTeam = DominationTeam(BLUE);
local domPointBlip = null;
local scoreTimer = null;
//
function onPlayerSpawn(player,spawn)
{
   local playerCount = GetPlayerCount();
   player.Team = playerCount % 2 == 0 ? 1 : 0 ;
}

function onPlayerCommand(player,cmd,text)
{
      if (cmd == "domination")
{
local playerPos = player.Pos;
local checkpointPos = Vector(playerPos.x + 5, playerPos.y + 5, playerPos.z);
CreateCheckpoint(checkpointPos,2.0, WHITE);
domPointBlip = CreateBlip(BLIP_NONE, checkpointPos);
domPointBlip.Colour = WHITE;
Message("Domination begins!");
     }
}

 function SetTeamScore(team)
{
   team.Score+=1;
   ::print(team.Score);
}

function onPlayerEnterCheckpoint(player, cp)
{
local playerTeamId = player.Team;
cp.Colour = playerTeamId == 0 ? RED : BLUE ;
domPointBlip.Colour = playerTeamId == 0 ? 0 : 1;
local playerTeam = playerTeamId == 0 ? redTeam : blueTeam;
Message(playerTeam.Name + " " + playerTeam.Score);
    NewTimer("SetTeamScore", 3000, 5, playerTeam);
   
}


4  Off Topic / General Chat / Re: Hi there guys on: June 28, 2017, 11:57:36 am
Thanks for invitation, I've joined Discord LU. I think it might be good place to share my Squirrel code problem.. or should I use forum for that?
5  Off Topic / General Chat / Hi there guys on: June 27, 2017, 10:20:15 pm
Hello guys, recently I bough GTA 3 on steam and Liberty Unleashed took my attention. I though - why not? So I downloaded it.  Not too many players, but still you can find someone to play basically everyday.
Because Im C# developer, writing scripts is what drew my attention to the highest degree.

I have some  personal projects also in Unity 3d and just .NET applications (ASP.NET MVC, WPF, even some console) but I just had to try it with Squirrel ;). Im currently trying out to create my own gamemode, will se how it goes.

Nice to meet you, guys ;).
Pages: [1]
© Liberty Unleashed Team.