08.04.2011, 10:30
Well do you see any type of problem on the following code? , cause when someone types something (Even some of the commands) my server crashes and closes up !
Code :
Code :
Код:
OnPlayerText Code 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 1; } if(strlen(text) < 1) { SendClientMessage(playerid,COLOR_ADMIN,"Your message must be longer!"); return 1; } 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 1; } if(Muted[playerid] == 1) { return 1; } TextSpammer[playerid] ++; if(TextSpammer[playerid] >= 5 && TextSpammer[playerid] <= 7) { SendClientMessage(playerid,COLOR_RED,SpammerDenied); TextSpammer[playerid] --; return 1; } if(TextSpammer[playerid] >= 8) { Kick(playerid); return 1; } 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 1; 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 1; 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 1; } 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 1; } } 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 1; }