30.05.2009, 16:00
hi ppl i made these chats but for some reason it aint working, Please note that i'm not getting any warnings / errors, also no clients / server crashing it just msg do not display. Help please.
Код:
if(strcmp("/l", cmdtext, true) == 0) { tmp = strtok(cmdtext, idx, strlen(cmdtext)); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /l [message]"); return 1; } new Float:cord1,Float:cord2,Float:cord3; GetPlayerPos(playerid,cord1,cord2,cord3); for (new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerClose(i,cord1,cord2,cord3,15)) { format(string,sizeof(string),"%s Said: %s",PlayerInfo[playerid][name],tmp); SendClientMessage(i,COLOR_GREY,string); } } return 1; } if(strcmp("/b", cmdtext, true) == 0) { tmp = strtok(cmdtext, idx, strlen(cmdtext)); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /b [message]"); return 1; } new Float:cord1,Float:cord2,Float:cord3; GetPlayerPos(playerid,cord1,cord2,cord3); for (new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerClose(i,cord1,cord2,cord3,20)) { format(string,sizeof(string),"%s OOC:(( %s ))",PlayerInfo[playerid][name],tmp); SendClientMessage(i,COLOR_GREY,string); } } return 1; } if(strcmp("/s", cmdtext, true) == 0) { tmp = strtok(cmdtext, idx, strlen(cmdtext)); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /s [message]"); return 1; } new Float:cord1,Float:cord2,Float:cord3; GetPlayerPos(playerid,cord1,cord2,cord3); for (new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerClose(i,cord1,cord2,cord3,30)) { format(string,sizeof(string),"%s Shouted: %s !!",PlayerInfo[playerid][name],tmp); SendClientMessage(i,COLOR_GREY,string); } } return 1; } if(strcmp("/o", cmdtext, true) == 0) { tmp = strtok(cmdtext, idx, strlen(cmdtext)); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /o [message]"); return 1; } format(string,sizeof(string),"%s Main Chat: %s",PlayerInfo[playerid][name],tmp); SendClientMessageToAll(COLOR_WHITE,string); return 1; } stock IsPlayerClose(playerid,Float:x,Float:y,Float:z,Float:MAX) { new Float:PPos[3]; GetPlayerPos(playerid, PPos[0], PPos[1], PPos[2]); if (PPos[0] >= floatsub(x, MAX) && PPos[0] <= floatadd(x, MAX) && PPos[1] >= floatsub(y, MAX) && PPos[1] <= floatadd(y, MAX) && PPos[2] >= floatsub(z, MAX) && PPos[2] <= floatadd(z, MAX)) { return 1; } return 0; }