Simple help - 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: Simple help (
/showthread.php?tid=641894)
Simple help -
silverms - 22.09.2017
so iv got an pm command
PHP код:
CMD:pm(playerid, params[])
{
new tmp[1080], giveplayerid, giveplayer[25], playername[25],string[1080];
if(adlvl[playerid] < 2 && !vipmember[playerid] && helper[playerid] == 0) return 0;
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
if (sscanf(params, "us", giveplayerid, tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /pm [playerid] [message]");
if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Inactive player id!");
if (giveplayerid == playerid) return SendClientMessage(playerid, COLOR_RED, "Error: You can't send private message to your self!");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
format(string, sizeof(string), "{E6E600}PM from %s(%d): %s", playername, playerid, tmp);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string,sizeof(string), "{FFFF00}PM to %s(%d): %s", giveplayer, giveplayerid, tmp);
SendClientMessage(giveplayerid, COLOR_YELLOW, "You can use /pmr [message] for fast reply.");
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
the problem is that the message be like PM FROM name: hi hru bro what ar
and the command cut off at Are o how can I fix it I tried to make the array bigger but didn't work
Re: Simple help -
pollo97 - 22.09.2017
Код:
CMD:pm(playerid, params[])
{
//I changed the size of tmp to 160
new tmp[160], giveplayerid, giveplayer[25], playername[25],string[256];
if(adlvl[playerid] < 2 && !vipmember[playerid] && helper[playerid] == 0) return 0;
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
//You must specify the size of the string when request the params
if (sscanf(params, "us[160]", giveplayerid, tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /pm [playerid] [message]");
if (!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: Inactive player id!");
if (giveplayerid == playerid) return SendClientMessage(playerid, COLOR_RED, "Error: You can't send private message to your self!");
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
GetPlayerName(giveplayerid, giveplayer, MAX_PLAYER_NAME);
format(string, sizeof(string), "{E6E600}PM from %s(%d): %s", playername, playerid, tmp);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
format(string,sizeof(string), "{FFFF00}PM to %s(%d): %s", giveplayer, giveplayerid, tmp);
SendClientMessage(giveplayerid, COLOR_YELLOW, "You can use /pmr [message] for fast reply.");
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
This will work.
Re: Simple help -
silverms - 24.09.2017
alright tnx

+ REP