Chat problem - 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: Chat problem (
/showthread.php?tid=265040)
Chat problem -
Tachibana - 29.06.2011
Got a small problem and I actually realize the problem, the problem is
pawn Код:
if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
the main problem is the IsPlayerAdmin which checks if player is a rcon admin which I dont want but I want it to be replaced with my one but not sure how it is done
pawn Код:
if(pData[playerid][Admin] < 1
this checks if player is an admin in my script tho it works that admins with that one can speak in the admin chat but they dont see messages unless they are rcon admin logged in... Here is the code
pawn Код:
COMMAND:psm(playerid,params[]) {
new
poster[40],
mess[128];
sscanf(params,"s",mess);
if(pData[playerid][Admin] < 1 && !IsPlayerAdmin(playerid))
return SendError(playerid, NOT_ADMIN_LEVEL_1 );
if(!isnull(mess)) {
for(new i = 0; i < MAX_PLAYERS; ++i) {
if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
new
text[512];
GetPlayerName(playerid,poster,sizeof(poster));
format(text,sizeof(text),"[Public Safety Chat] | %s: %s",poster,mess);
SendClientMessage(i,COLOR_MOCCASIN ,text);
}
}
} else {
return SendClientMessage(playerid,COLOR_GRAY,"SYNTAX: /psm [Message]");
}
return 1;
}
this is a admin chat (I call it Public Safety beside admins to make it sound unique ^^) (The main problem is at when it starts isplayerconnected)
Re: Chat problem -
Raimis_R - 29.06.2011
pawn Код:
COMMAND:psm(playerid,params[])
{
new
poster[40],
mess[128];
if(sscanf(params,"s[128]",mess)
{
return SendClientMessage(playerid,COLOR_GRAY,"SYNTAX: /psm [Message]");
}
if(pData[playerid][Admin] < 1 && !IsPlayerAdmin(playerid))
{
return SendError(playerid, NOT_ADMIN_LEVEL_1 );
}
if(!isnull(mess))
{
for(new i = 0; i < MAX_PLAYERS; ++i)
{
if(IsPlayerConnected(i) && IsPlayerAdmin(i))
{
new
text[512];
GetPlayerName(playerid,poster,sizeof(poster));
format(text,sizeof(text),"[Public Safety Chat] | %s: %s",poster,mess);
SendClientMessage(i,COLOR_MOCCASIN ,text);
}
}
}
return 1;
}
Re: Chat problem -
Tachibana - 29.06.2011
Quote:
Originally Posted by Raimis_R
pawn Код:
COMMAND:psm(playerid,params[]) { new poster[40], mess[128];
if(sscanf(params,"s[128]",mess) { return SendClientMessage(playerid,COLOR_GRAY,"SYNTAX: /psm [Message]"); } if(pData[playerid][Admin] < 1 && !IsPlayerAdmin(playerid)) { return SendError(playerid, NOT_ADMIN_LEVEL_1 ); } if(!isnull(mess)) { for(new i = 0; i < MAX_PLAYERS; ++i) { if(IsPlayerConnected(i) && IsPlayerAdmin(i)) { new text[512];
GetPlayerName(playerid,poster,sizeof(poster)); format(text,sizeof(text),"[Public Safety Chat] | %s: %s",poster,mess); SendClientMessage(i,COLOR_MOCCASIN ,text); } } } return 1; }
|
Oh thank u but just got one error ^^,
pawn Код:
(635) : error 001: expected token: ")", but found "{"
pawn Код:
if(sscanf(params,"s[128]",mess)
{
Re: Chat problem -
Wesley221 - 29.06.2011
pawn Код:
if(sscanf(params,"s[128]",mess))
He forgot a )
Re: Chat problem -
Raimis_R - 29.06.2011
Sorry change to
pawn Код:
if(sscanf(params,"s[128]",mess))
Edit: to slow
Re: Chat problem -
Tachibana - 29.06.2011
Still not working