if i do "@" for admin chat gamemode restarts - 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: if i do "@" for admin chat gamemode restarts (
/showthread.php?tid=113844)
if i do "@" for admin chat gamemode restarts -
shoru93 - 16.12.2009
if(text[0] == '@')
{
new string[256], pName[24];
if(PlayerInfo[playerid][AdminLevel] < 1)
{
GetPlayerName(playerid,pName,sizeof(pName));
format(string, sizeof(string), "Admin Chat: %s: %s", pName, text[1]);
SendModMsg(COLOR_YELLOW, string);
}
return 0;
}
return 1;
}
Re: if i do "@" for admin chat gamemode restarts -
CracK - 16.12.2009
Try this:
pawn Код:
if(text[0] == '@')
{
new string[256], pName[24];
if(PlayerInfo[playerid][AdminLevel] < 1)
{
GetPlayerName(playerid,pName,sizeof(pName));
strdel(text, 0, 1);
format(string, sizeof(string), "Admin Chat: %s: %s", pName, text);
SendModMsg(COLOR_YELLOW, string);
}
return 0;
}
return 1;
}
Re: if i do "@" for admin chat gamemode restarts -
CaHbKo - 16.12.2009
pawn Код:
if(text[0] == '@')
{
new string[256], pName[24];
if(PlayerInfo[playerid][AdminLevel] < 1)
{
GetPlayerName(playerid,pName,sizeof(pName));
strdel(text, 0, 1);
format(string, sizeof(string), "Admin Chat: %s: %s", pName, text);
SendModMsg(COLOR_YELLOW, string);
} // ;]
}
return 0;
}
return 1;
}
Re: if i do "@" for admin chat gamemode restarts - Zeex - 16.12.2009
pawn Код:
public OnPlayerText(playerid, text[])
{
if (text[0] == '@' && PlayerInfo[playerid][AdminLevel] < 1)
{
new
name[MAX_PLAYER_NAME]; // it's better to use define instead of its value (24 in this case)
// as it makes your code more readable
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
// here we don't make a new string, just use already existing one (at least it works for me)
format(text, 128, "Admin Chat: %s: %s", name, text[1]);
// I'm not sure but perhaps this is what crashes your server
SendModMsg(COLOR_YELLOW, text);
return 0;
}
return 1;
}
Could you show us SendModMsg code?
Re: if i do "@" for admin chat gamemode restarts -
LarzI - 16.12.2009
Uhm
pawn Код:
if (text[0] == '@' && PlayerInfo[playerid][AdminLevel] < 1)
Are you sure you want only players with level 0 or less to use this?