One thing, someone 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: One thing, someone help. (
/showthread.php?tid=83535)
One thing, someone help. -
Dreftas - 25.06.2009
pawn Код:
//==========ADMIN CHAT================//
if(text[0] == '@' && pInfo[playerid][AdminLvl] > 0)
{
new AdminName[MAX_PLAYER_NAME], AdminText[128];
GetPlayerName(playerid,AdminName,sizeof(AdminName));
format(AdminText,sizeof(AdminText),"%s: %s",AdminName,text[1]);
SendClientMessageToAdmins(0xA954FFFF,AdminText);
return false;
}
//=====================================//
Its good
@ [text] but i want to make
// [text] is it possible to do that? Because replacing @ with // doesn't work, i get error
error 027: invalid character constant
Re: One thing, someone help. -
bigcomfycouch - 25.06.2009
maybe a '//' command?
Re: One thing, someone help. -
Cezar - 25.06.2009
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new command[32],params[96];
if (strfind(cmdtext, " ", false) != -1)
{
strmid(command, cmdtext, 0, strfind(cmdtext, " ", false));
strmid(params, cmdtext, strfind(cmdtext, " ", false), strlen(cmdtext));
}
if (strcmp(command, "//", true) == 0)
{
new AdminName[MAX_PLAYER_NAME], AdminText[128];
GetPlayerName(playerid,AdminName,sizeof(AdminName));
format(AdminText,sizeof(AdminText),"%s: %s",AdminName,params);
SendClientMessageToAdmins(0xA954FFFF,AdminText);
return 1;
}
return 0;
}
Here you go mate. The first "if" finds the space between the command and the parameters (/command parameters). The second if is your command ( // [text] ). What this does is send everything the player types after //[space] to the admins.
Just add everything in your OnPlayerCommandText(playerid, cmdtext[]) and it should work.
Re: One thing, someone help. -
Dreftas - 25.06.2009
Thx a lot, it works