Something is wrong with my afk cmd... - 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: Something is wrong with my afk cmd... (
/showthread.php?tid=64341)
Something is wrong with my afk cmd... -
SEC - 03.02.2009
Hey,
I want to make the cmd /afk [minutes].But with my code it says for exemple: "Player (ID:0) is now in AFK-Mode ! Minutes:z"
Here is my script:
Код:
if(strcmp(cmd, "/afk", true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /afk [minutes]");
new name[MAX_PLAYER_NAME+1];
new string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s (ID:%i) is now in AFK-Mode ! Minutes:%z.", name,playerid,strlen(tmp));
SendClientMessageToAll(0xDBD993FF,string);
return 1;
}
I hope someone will find whatґs wrong...
Re: Something is wrong with my afk cmd... -
Ycto - 03.02.2009
Replace:
pawn Код:
format(string, sizeof(string), "%s (ID:%i) is now in AFK-Mode ! Minutes:%z.", name,playerid,strlen(tmp));
With:
pawn Код:
format(string, sizeof(string), "%s (ID:%i) is now in AFK-Mode ! Minutes:%d.", name,playerid,strlen(tmp));
That should work, if the rest of your code is correct =)
Good luck!
Re: Something is wrong with my afk cmd... -
SEC - 03.02.2009
Sry this doesnґt work . It will just count how many numbers are behind /afk (for example : by typing /afk 222222 you get 6 Minutes)
Re: Something is wrong with my afk cmd... -
Ycto - 03.02.2009
Quote:
Originally Posted by SEC
Sry this doesnґt work . It will just count how many numbers are behind /afk (for example : by typing /afk 222222 you get 6 Minutes)
|
Then I don't really get what you want with that command :O
On sight, I assumed you wanted to get this:
When a player types /afk 3 you want to say (example):
Test (ID:0) is now in AFK-Mode ! Minutes:3
It wont do something else (like, put [AFK] in front of the player's name, or whatever), you haven't scripted it.
Re: Something is wrong with my afk cmd... -
mabako - 03.02.2009
Quote:
Originally Posted by SEC
Sry this doesnґt work . It will just count how many numbers are behind /afk (for example : by typing /afk 222222 you get 6 Minutes)
|
Use strval and not strlen
Re: Something is wrong with my afk cmd... -
SEC - 03.02.2009
thank you , that was what i was searching for .
Re: Something is wrong with my afk cmd... -
Ycto - 03.02.2009
Quote:
Originally Posted by mabako
Quote:
Originally Posted by SEC
Sry this doesnґt work . It will just count how many numbers are behind /afk (for example : by typing /afk 222222 you get 6 Minutes)
|
Use strval and not strlen
|
Looooool! I don't pay enough attention