I need Help Again =]]z -
thienle7090 - 31.08.2016
Warning : /includes/NGGv5.1.pwn(99319) : warning 219: local variable "string" shadows a variable at a preceding level
That line : new string[128];
format(string, sizeof(string), "Hay Deo Day An Toan Vao De Bao Ve Mang Song Cua Ban((/sb))");
SendClientMessage(playerid, 0xFFFFFFAA, string);
i Put that line under public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
Re: I need Help Again =]]z -
ThatFag - 31.08.2016
there is already a string defined as "string" etc you have defined it 2x new string and again new string
change to
Код:
new stringg[128];
format(stringg,sizeof(stringg),"Hay Doe Day An Toan Vao De Bao Ve Mang Song Cua Ban ((/sb))");
SendClientMessage(playerid,0xFFFFFFAA,stringg);
Re: I need Help Again =]]z -
Spmn - 31.08.2016
You don't need to use format since there is no variable in your message. Simply do:
Код:
SendClientMessage(playerid,0xFFFFFFAA,"Hay Doe Day An Toan Vao De Bao Ve Mang Song Cua Ban ((/sb))");
Re: I need Help Again =]]z -
saffierr - 31.08.2016
Quote:
Originally Posted by Spmn
You don't need to use format since there is no variable in your message. Simply do:
Код:
SendClientMessage(playerid,0xFFFFFFAA,"Hay Doe Day An Toan Vao De Bao Ve Mang Song Cua Ban ((/sb))");
|
The first time I heard this, I was like 'what? what do you mean I don't have to use a 'format' '.
Well let me explain you.
Format is mainly used for variables.
Example 1 (wrong way to use format)
PHP код:
format(string, sizeof string, "Hello I am happy.");
Do you see? You have got no variable to specify. In this case you just use SendClientMessage.
Example 2 (correct way to use format)
PHP код:
format(string, sizeof string, "%s is happy.", pName);
Do you see the difference? in this format you specified a variable.
I hope you understood this.
(( Pretend as if the string/pName variable is already defined. ))
Re: I need Help Again =]]z -
J0sh... - 31.08.2016
There's no wrong way to use format.
Let's for example have this:
PHP код:
new str[128];
if(phidden[playerid])
format(str, sizeof(str), "Someone typed this.");
else
format(str, sizeof(str), "%s typed this.", name);
You won't need to retype the whole logic in an if statement.
But yes, if you don't see yourself doing an if statement to edit the string, then just use SCM.