OnPlayerText problem
#1

i have a problem with this code. its just not play. i mean if i write @hi for admin talk the server (samp-server.exe) close. and this happening in all for example if i write acceot the same. im looking the code again and again and i cant find the reason.

Код:
public OnPlayerText(playerid, text[])
{
    RecordPlayerText(playerid,text);
    new namer[24],string[156];
    GetPlayerName(playerid,namer,sizeof(namer));
    format(string,sizeof(string),"13%s[%d] Got Kicked - Reason: Advertising",namer,playerid);
    if(FindIP(text)) { ircSay(EchoConnection,EchoChan,string); return kick4IP(playerid); }


	if(!strcmp( text, "acceot", true))
	{
        if(Accept[playerid] == 0)
        {
            Accept[playerid] = 1;
            SendClientMessage(playerid, COLOR_YAY, ">> Thanks, You have agreed to our rules here, Have Fun!");
            TogglePlayerControllable(playerid, 1);
            TextDrawHideForPlayer(playerid,txtTypeAccept);
            TextDrawHideForPlayer(playerid,txtTypeAccept2);
            TextDrawHideForPlayer(playerid,txtTypeAccept3);
			if(NewlyReg[playerid] == 1)
			{
				new player[30];
				GetPlayerName(playerid,player,30);
                format(string, sizeof(string), "~w~Welcome To ~p~The Server~n~~b~%s~n~~w~Type ~y~/help ~w~, ~w~/rules ~w~or~n~~y~/cmds~w~for more game info", player);
                TextDrawSetString(txtAdminAnnounce,string);
                TextDrawShowForPlayer(playerid,txtAdminAnnounce);
                AdminAnnouncedRNT =10;
			}
        }
	}


    
    if (text[0] == '@')
    {
		if(!IsServerAdmin(playerid))
		{
            SendClientMessage(playerid,COLOR_ADMIN,"Invalid Admin Status");
            return 0;
		}

		if(strlen(text) < 1)
		{
		    SendClientMessage(playerid,COLOR_ADMIN,"Your message must be longer!");
		    return 0;
		}
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(text, 128, "[ADMIN CHAT] %s:%s", name, text[1]);
	    SendClientMessageToAllAdmins(text);
     	ircSay(EchoConnection,EchoChan2,text);
        return 0;
    }
    

    

    
    if(Muted[playerid] == 1)
    {
		return 0;
    }
    
    TextSpammer[playerid] ++;

	if(TextSpammer[playerid] >= 5 && TextSpammer[playerid] <= 7)
	{
		SendClientMessage(playerid,COLOR_RED,SpammerDenied);
		TextSpammer[playerid] --;
		return 0;
	}

	if(TextSpammer[playerid] >= 8)
	{
		Kick(playerid);
		return 0;
	}
   	new PlayerName1[24];
   	new tString[128];
   	new Num[MAX_SERVER_SLOTS] = -1;
   	Num[playerid]=randarg(5,3,10);


	GetPlayerName(playerid, PlayerName1, sizeof(PlayerName1));

    if(IsPlayerNPC(playerid)) return 0;
	if(gTeam[playerid] >= 1 && gTeam[playerid] <= 2 && Undercover[playerid] == 0 && !IsPlayerNPC(playerid))
	{
	    format(tString, sizeof(tString), "12 %s [%d] - %s",PlayerName1,playerid, text);
        ircSay(EchoConnection,EchoChan,tString);
	}
	
	if(gTeam[playerid] >= 1 && gTeam[playerid] <= 2 && Undercover[playerid] == 1 && !IsPlayerNPC(playerid))
	{
	    format(tString, sizeof(tString), "1 %s [%d] - %s",PlayerName1,playerid, text);
        ircSay(EchoConnection,EchoChan,tString);
	}

	if(gTeam[playerid] >= 3 && gTeam[playerid] <= 4 && !IsPlayerNPC(playerid))
	{
 	    format(tString, sizeof(tString), "5 %s [%d] - %s",PlayerName1,playerid, text);
        ircSay(EchoConnection,EchoChan,tString);
	}

	if(gTeam[playerid] >= 5 && !IsPlayerNPC(playerid))
	{
		new Wanted = GetPlayerWantedLevel(playerid);
		if(Wanted >= 0 && Wanted <= 3)
		{
	        format(tString, sizeof(tString), "1 %s [%d] - %s",PlayerName1,playerid, text);
            ircSay(EchoConnection,EchoChan,tString);
        }
		if(Wanted >= 4 && Wanted <= 9&& !IsPlayerNPC(playerid))
		{
	        format(tString, sizeof(tString), "7 %s [%d] - %s",PlayerName1,playerid, text);
            ircSay(EchoConnection,EchoChan,tString);
        }
		if(Wanted >= 10 && !IsPlayerNPC(playerid))
		{
	        format(tString, sizeof(tString), "4 %s [%d] - %s",PlayerName1,playerid, text);
            ircSay(EchoConnection,EchoChan,tString);

        }
	}


	
    for(new d; d<sizeof(Filter); d++)
    

    
    
	if(strfind(text,Filter[d],true) != -1 ) return 0;
	

	
	if(!strcmp( text, "RehaB", true)) // Weps Dealer
    {
        if(IsPlayerInRangeOfPoint(playerid, 3.0, 784.0547,-1131.4712,23.8281))
		{
		    if(gTeam[playerid] <= 2) return SendClientMessage(playerid,COLOR_YELLOW,"PM From RehaB: Hey Officer! Nothing to see here!");

                if(IsThereAnyCopsNearMe(playerid))
				{
					PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
					SendClientMessage(playerid,COLOR_YELLOW,"PM From RehaB: Come back later! There is a Police Officer nearby!");
					ApplyAnimation(GetRehaBID(),"PED","IDLE_CHAT",4.1,0,1,1,0,-1);
					return 0;
				}
			SendClientMessage(playerid,COLOR_YELLOW,"PM From RehaB: Hey! What you want?");
			PlayerPlaySound(playerid, 1137, 0.0, 0.0, 0.0);
    		ApplyAnimation(GetRehaBID(),"PED","IDLE_CHAT",4.1,0,1,1,0,-1);
    		ShowPlayerDialog(playerid,DIALOG_REHAB_OPTIONS,2,"Please select an option from below!","Buy Weapons from RehaB\nBuy Drugs from RehaB","Go","Cancel");
			return 0;
		}
	}




    new pname[MAX_PLAYER_NAME+5];
    new pname2[MAX_PLAYER_NAME+5];
    GetPlayerName(playerid,pname,sizeof(pname));
    format(pname2,sizeof(pname2),"%s[%d]",pname,playerid);
    SetPlayerName(playerid,pname2);
    SendPlayerMessageToAll(playerid,text);
    SetPlayerName(playerid,pname);
    return 0;
}
the code its not mine its from a gm but i think its not problem if a place the problem and code write?
thanks anyway
Reply
#2

pls someone!!!
Reply
#3

BUMP>>>>>
Reply
#4

sry,I can't understand your script, anyway

try to use {}{} here
pawn Код:
for(new d; d<sizeof(Filter); d++)
{    
if(strfind(text,Filter[d],true) != -1 ) return 0;
}
Reply
#5

doesnt work. thanks anyway!!!
Reply
#6

Is this a problem when you compile? because it would be useful if you copied with errors into this thread
Reply
#7

no errors or warnings!!!
Reply
#8

<bump>!!!!
Reply
#9

Debug your code to see at which point it crashes (put some printfs in the code)
Reply
#10

Check this script part, because you know whats happen when two trains drive on one rail !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)