I have a little bug - 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: I have a little bug (
/showthread.php?tid=317218)
I have a little bug -
Join7 - 10.02.2012
I have a little bug. When I respond to PM a /r [text], the recipient does not receive the words that I wrote after intervals.
Text after the first space is not visible (by /r [text])
Код:
if(strcmp(cmd, "/r", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /r [text]");
return 1;
}
giveplayerid = GetPVarInt(playerid, "LastID");
if (IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
format(string, sizeof(string), "* PM from %s(ID: %d): %s", PlayerName(playerid), playerid, tmp);
SendClientMessage(giveplayerid, 0xffff00ff, string);
}
}
format(string, sizeof(string), "* PM to %s(ID: %d): %s", giveplayer, giveplayerid, tmp);
SendClientMessage(playerid, 0xffff00ff, string);
return 1;
}
}
else
{
SendClientMessage(playerid, 0xFF0000FF, "You didn't have a PM!");
}
}
return 1;
}
Re: I have a little bug -
Babul - 10.02.2012
if you would use the sscanf2 plugin, it would be easier to make that command (also using zcmd).
Re: I have a little bug -
Join7 - 10.02.2012
sscanf 2.5 is the latest version. Can you fix code?
Re: I have a little bug -
Join7 - 10.02.2012
Can you give me correct code because I make more mistakes.
Re: I have a little bug -
Join7 - 10.02.2012
I fixed it, thank ******
Re: I have a little bug -
MP2 - 10.02.2012
Why are you checking IsPlayerConnected? How can non-connected players send commands? Think about it.