Problem -
Roko_foko - 02.07.2011
Hello.
This really pisses me off. I need help. it's not that important what this If checks(I think) because it doen't enter in any of this two clausses.
pawn Код:
public OnPlayerText(playerid, text[])
{
if(gCalled[gCalled[playerid]]!= -1 && gCalled[playerid]!=-1)
{
new string[MAX_STRING];
format(string,sizeof(string),"Cellphone: %s",text);
SendClientMessage(gCalled[playerid],COLOUR_YELLOW,string);
format(string,sizeof(string),"%s says: %s",gPLAYER_NAME[playerid],text);
GetPlayerPos(playerid, PLAYER_XPOS[playerid], PLAYER_YPOS[playerid], PLAYER_ZPOS[playerid]);
GetPlayerVirtualWorld(playerid);
GetPlayerInterior(playerid);
for(new i=0;i<gPlayers;i++)
{
if(IsPlayerInRangeOfPoint(i, 5.0, PLAYER_XPOS[playerid], PLAYER_YPOS[playerid], PLAYER_ZPOS[playerid]) && (GetPlayerInterior(playerid) == GetPlayerInterior(i)) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
SendClientMessage(i,COLOUR_WHITE, string);
}
else if(IsPlayerInRangeOfPoint(i, 10.0, PLAYER_XPOS[playerid], PLAYER_YPOS[playerid], PLAYER_ZPOS[playerid]) && (GetPlayerInterior(playerid) == GetPlayerInterior(i)) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
SendClientMessage(i,COLOUR_FADE4,string);
}
else if(IsPlayerInRangeOfPoint(i, 20.0, PLAYER_XPOS[playerid], PLAYER_YPOS[playerid], PLAYER_ZPOS[playerid]) && (GetPlayerInterior(playerid) == GetPlayerInterior(i)) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
SendClientMessage(i,COLOUR_FADE5,string);
}
}
}
else
{
new string[MAX_STRING];
format(string,sizeof(string),"%s says: %s",gPLAYER_NAME[playerid],text);
GetPlayerPos(playerid, PLAYER_XPOS[playerid], PLAYER_YPOS[playerid], PLAYER_ZPOS[playerid]);
GetPlayerVirtualWorld(playerid);
GetPlayerInterior(playerid);
for(new i=0;i<gPlayers;i++)
{
if(IsPlayerInRangeOfPoint(i, 5.0, PLAYER_XPOS[playerid], PLAYER_YPOS[playerid], PLAYER_ZPOS[playerid]) && (GetPlayerInterior(playerid) == GetPlayerInterior(i)) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
SendClientMessage(i,COLOUR_WHITE, string);
}
else if(IsPlayerInRangeOfPoint(i, 10.0, PLAYER_XPOS[playerid], PLAYER_YPOS[playerid], PLAYER_ZPOS[playerid]) && (GetPlayerInterior(playerid) == GetPlayerInterior(i)) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
SendClientMessage(i,COLOUR_FADE4,string);
}
else if(IsPlayerInRangeOfPoint(i, 20.0, PLAYER_XPOS[playerid], PLAYER_YPOS[playerid], PLAYER_ZPOS[playerid]) && (GetPlayerInterior(playerid) == GetPlayerInterior(i)) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
SendClientMessage(i,COLOUR_FADE5,string);
}
}
}
return 0;
}
It sends me Chat "NAME[orange]:text[white]" only, but why? It should enter one of this two clausses and send normal sentences. Please help me.
Re: Problem -
Roko_foko - 02.07.2011
pawn Код:
public OnPlayerText(playerid, text[])
{
SendClientMessage(playerid,COLOUR_GREY,"ERROR");
if(gCalled[gCalled[playerid]]!= -1 && gCalled[playerid]!=-1)
{
return 0;
}
else
{
return 0;
}
}
Even in this code, it sends me :ERROR, then "NAME:TEXT" , What the ?
Re: Problem -
Roko_foko - 02.07.2011
Is it possible that this if isn't true but isn't false at same moment?
Re: Problem -
Roko_foko - 02.07.2011
I found out that problem is in gCaller[playerid] var, it exists in if() so the problem appears, i tried to test it without if and else and it worked okay. I tried to printf("%d %d",gCalled[playerid],gCalled[gCalled[playerid]]); and problem appeared again. Does someone knows what I did wrong with the gCalled[playerid] var?
Re: Problem -
Roko_foko - 02.07.2011
The problem was Variable.
I found out that if you put in callback a variable that doesn't exist(gCalled[-1]), the program will return 1 the callback.