SA-MP Forums Archive
A little problem with a string - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: A little problem with a string (/showthread.php?tid=333722)



A little problem with a string - Libra_PL - 12.04.2012

Hi.

I've got a small problem, I'm trying to fix it using some ways, no one works. Well, it's a command which sets variable's string with params. It's same like setting LastPlayerText with text in OnPlayerText. It looks like:

pawn Код:
new var[128];

var = ...;
What should I put in "..." (it's a string)? With a number it would be strval(params), but I've got a problem with characters (for example, var should be "winner") - could anyone help?


Re: A little problem with a string - IstuntmanI - 12.04.2012

format( var, 128, "%s", strval( params ) );

Or what do you want ?


Re: A little problem with a string - park4bmx - 12.04.2012

pawn Код:
new Var[128];
format(Var,sizeof(Var),"Winner");
//Or
strins(Var, "Winner", sizeof(Var));



Re: A little problem with a string - Libra_PL - 12.04.2012

Hm, no one did this right how I wanted, but costel gave me a way how to do it (just 'params', not strval(params), it's not a number), so I will give reputation to him.


Re: A little problem with a string - iKn0w - 12.04.2012

format(var, 128, "%s", ("None"));

Ex:
format(var, 128, "%s", text);