DCMD String Help me. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: DCMD String Help me. (
/showthread.php?tid=79808)
DCMD String Help me. -
Ace_Menace - 31.05.2009
[color=brown]Hello. I have a new error, this time I cannot figure out what to do for my function, to give out the Value inside of the String.
Example:
Quote:
Hello, my name is bob. I am [Function Value Here] Years old.
|
The text of the string comes up, just not the %s part.
Here's my code, help me to get it like Above ^
Код:
public OnPlayerCommandText(playerid, cmdtext[]) {
dcmd(checksober, 10, cmdtext);
return 0;
}
dcmd_checksober(playerid, params[])
{
new
id,
abc[64];
if (strlen(params))
{
id = strval(params);
if (IsPlayerConnected(id))
{
GetPlayerDrunkTime(id);
format(abc, sizeof (abc), "The Player's Drunk Level is %s.");
SendClientMessage(id, 0x00FF00AA, "You have been tested for your Soberness");
SendClientMessage(playerid, 0x00FF00AA, abc);
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/checksober <playerid>\"");
}
return 1;
}
Re: [FS - Help] DCMD Command -
Correlli - 31.05.2009
Do you have this filterscript in the filterscripts folder?
Show your 'filterscripts' line from server.cfg.
Re: [FS - Help] DCMD Command -
Ace_Menace - 31.05.2009
I have looked up and down the Wiki, and just cannot find what I need.
Re: DCMD String Help me. -
Ace_Menace - 31.05.2009
* New Error, didn't want to make new topic..bumping, I need this solved quickly. *
Re: DCMD String Help me. -
Ignas1337 - 31.05.2009
uh.. if it's strval, the nwhy use %s? if it's a value (decimal/integer) use %d or %i...
Re: DCMD String Help me. -
Ace_Menace - 31.05.2009
Quote:
Originally Posted by Ignas1337
uh.. if it's strval, the nwhy use %s? if it's a value (decimal/integer) use %d or %i...
|
Thanks for the Help,
Now I get this:
Quote:
Player's Drunk Level is 0.
|
Even though it isn't zero.
Re: DCMD String Help me. -
yom - 31.05.2009
Because you never assign %d to something so it's 0..
Change this
pawn Код:
GetPlayerDrunkTime(id);
format(abc, sizeof (abc), "The Player's Drunk Level is %s.");
to
pawn Код:
format(abc, sizeof (abc), "The Player's Drunk Level is %d.", GetPlayerDrunkTime(id));
Re: DCMD String Help me. -
Ace_Menace - 31.05.2009
Quote:
Originally Posted by 0rb
Because you never assign %d to something so it's 0..
Change this
pawn Код:
GetPlayerDrunkTime(id); format(abc, sizeof (abc), "The Player's Drunk Level is %s.");
to
pawn Код:
format(abc, sizeof (abc), "The Player's Drunk Level is %d.", GetPlayerDrunkTime(id));
|
Hmm, I did this. But still doesn't seem to work
Just gives the 0, each time.