[Help]CallLocal/RemoteFunction
#1

Well,not very bad,but I need ur help.
How to pass null string by CallLocal/RemoteFunction?
pawn Код:
#include <a_samp>
main(){}
public OnGameModeInit(){
  print "test1"
  CallLocalFunction("test","s","");
  print "test2"
  return true;
}

forward test(str[]);
public test(str[]){
  if(str[0]) print "not null string"
  else(str[0]) print "null string"
}
It'll crash my server.

I puzzled a day long,someone able to help me?
Thx.
Reply
#2

No -proper- solution for this, but in what case you will pass an empty string to it?
Reply
#3

Quote:
Originally Posted by 0rb
No -proper- solution for this, but in what case you will pass an empty string to it?
Mhm, There's actually a proper solution because he just messed up the script........... If he knew how to organize it, then yeah the solution will be fixed. I put that in my script i had like 1 million errors, then I tried to fix it for 5 minutes and I had 3 or 2 errors :S I'm going to try to fix it so I can post it.... Brb
Reply
#4

Reply for Orb:
something like:
pawn Код:
forward command(playerid,params[]);
public command(playerid,params[]){
  if(!params[0])return SendClientMessage(playerid,COLOR_SYSTEM,"no param.");
  else blablablablah..
  return true;
}
Reply for [CK]Steel:
Waitting for you solution,Don't make me dispointted.


PS:I've looked many code,but find no solution.
Reply
#5

I used to do this i will see if I can find it in my script hold on..


EDIT: Nevermind, mine was calling something without transferring any variables at all.
Reply
#6

Reply for Lavamike
Thx for ur help.
Reply
#7

The only solution i can think of now, is to do something like that:

pawn Код:
#include <a_samp>
main(){}
public OnGameModeInit()
{
  print("test1");

  new bla[] = ""; // = "blabla";
 
  if (bla[0])
    CallRemoteFunction("test", "s", bla);
  else
    CallRemoteFunction("test", "s", "<NULL>");

  print ("test2");
  return true;
}

forward test(str[]);
public test(str[])
{
  if (!strcmp(str, "<NULL>"))
    print("null string");
  else
    print("not null string");
}
But i think you already knew that.
Reply
#8

Reply for Orb:
Hehe,if my code is only used by me, I'll do what you do.
But it'll be used for other user,and they're almost used useing !param[0].
Anyway,thx for ur help.

Reply
#9

Now,any help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)