Author Topic: can't CallServerFunction  (Read 1654 times)

sasha19323

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +25/-24
    • View Profile
can't CallServerFunction
« on: January 20, 2013, 11:31:40 am »
Hi again :D
Here is Client-side script
Code: [Select]
local plr = FindLocalPlayer();
CallServerFunc( "Scripts/TC/Main.nut", "tdm1", plr, plr);
And Server-side
Code: [Select]
function tdm1(plr)
{
PagerMessage( plr, "ALLO YOBA ETO TI?", 140, 1, 2 );
}

It's not work. I think problems is in tdm1 function, but idk how to make it work.

Shadow.

  • Tester
  • Full Member
  • ****
  • Posts: 144
  • Karma: +16/-35
    • View Profile
Re: can't CallServerFunction
« Reply #1 on: January 20, 2013, 12:37:29 pm »
Quote
CallServerFunc( "Scripts/TC/Main.nut", "tdm1", plr, plr);

why 2x plr ?

use

Code: [Select]
CallServerFunc( "Scripts/TC/Main.nut", "tdm1", plr );
...

sasha19323

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +25/-24
    • View Profile
Re: can't CallServerFunction
« Reply #2 on: January 20, 2013, 12:54:28 pm »
Quote
CallServerFunc( "Scripts/TC/Main.nut", "tdm1", plr, plr);


why 2x plr ?

use

Code: [Select]
CallServerFunc( "Scripts/TC/Main.nut", "tdm1", plr );
...

Doesn't work
http://liberty-unleashed.co.uk/LUWiki/Squirrel/Client/Functions/Scripts/CallServerFunc
look at arguments

sasha19323

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +25/-24
    • View Profile
Re: can't CallServerFunction
« Reply #3 on: January 20, 2013, 02:32:57 pm »
I've looked at SpawnRamp script and saw this:
Code: [Select]
function SpawnRamp()
{
local veh = g_pLocalPlayer.Vehicle;
if ( veh )
{
local driver = veh.Driver;
if ( driver && driver.ID == g_pLocalPlayer.ID )
{
CallServerFunc( "ramps/ramp.nut", "SpawnRamp", g_pLocalPlayer.ID, false );
}
}
}
Why there is g_pLocalPlayer.ID?

sasha19323

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +25/-24
    • View Profile
Re: can't CallServerFunction
« Reply #4 on: January 20, 2013, 03:47:15 pm »
Thx all, i've found problem

 

© Liberty Unleashed Team.