Someone can make me a newbie chat channel with /nonewbie for admin to toggle it? - 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: Someone can make me a newbie chat channel with /nonewbie for admin to toggle it? (
/showthread.php?tid=246825)
Someone can make me a newbie chat channel with /nonewbie for admin to toggle it? -
anantanni - 06.04.2011
Title says it all without a please :P
So please do it someone, i'll be thankful.
Other info :
To check if player is admin - [pAdminLevel]
To check if player is tester - [pTester]
Or whatever it is IDK
Re: Someone can make me a newbie chat channel with /nonewbie for admin to toggle it? -
Elka_Blazer - 06.04.2011
Will make you a little FS and edit after I finish.
Edit :
on the top of your script :
under OnGameModeInIt
under OnPlayerCommandText
pawn Код:
if(strcmp(cmd,"/new",true) == 0)
{
if(NewBie == 0) return SendClientMessage(playerid,0x00ccccff,"The newbie chat is disabled !");
if(NewBie == 1)
{
new string[256];
string = strrest(cmdtext, idx);
if(!strlen(string)) return SendClientMessage(playerid,0xcc0000ff,"Usage : /new [TEXT] !");
SendClientMessageToAll(0x00ccccff,string);
}
return 1;
}
if(strcmp(cmd,"/nonewbie",true) == 0)
{
if(PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid,0xcc0000ff,"You are not an admin !");
if(PlayerInfo[playerid][pAdminLevel] > 0)
{
switch(NewBie)
{
case 0:
{
NewBie = 1;
SendClientMessage(playerid,0x999999ff,"The newbie chat is not ON. !");
}
case 1:
{
NewBie = 0;
SendClientMessage(playerid,0x999999ff,"The newbie chat is not OFF. !");
}
}
}
return 1;
}
and at the very end of your script
pawn Код:
stock strrest(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[128];
while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Last thing
if you dont have new cmd[256], idx; under onplayercommand text the add it .....
if you want me to explain you the code just tell me.
Re: Someone can make me a newbie chat channel with /nonewbie for admin to toggle it? -
anantanni - 07.04.2011
Код:
G:\EL-RP\gamemodes\el-rp.pwn(10709) : warning 219: local variable "string" shadows a variable at a preceding level
Re: Someone can make me a newbie chat channel with /nonewbie for admin to toggle it? -
Stigg - 07.04.2011
Quote:
Originally Posted by anantanni
Код:
G:\EL-RP\gamemodes\el-rp.pwn(10709) : warning 219: local variable "string" shadows a variable at a preceding level
|
Change:
To:
Re: Someone can make me a newbie chat channel with /nonewbie for admin to toggle it? -
anantanni - 07.04.2011
1 last thing
How to format it?
I mean when you type
it appears
how to make it
Код:
**Newbie chat : (PlayerName) : lol**
?
Re: Someone can make me a newbie chat channel with /nonewbie for admin to toggle it? -
anantanni - 07.04.2011
Anyone?
EDIT : W00t! Just became a big clucker with this post