22.06.2012, 20:27
This is a loop inside /call command. The problem is, when ever I call someone it keeps saying "Invalid phone number.", even though I typed in the right one. The phonenumber shows correctly in /stats and works with /sms.
Can someone please check this loop, maybe you can notice the problem:
Can someone please check this loop, maybe you can notice the problem:
pawn Code:
for(new i = 0; i < MAX_ONLINE_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
format(string, sizeof(string), "%d", PlayerInfo[i][pPhoneNumber]);
if(PlayerInfo[i][pPhoneNumber] == phonenumb && phonenumb > 0 || strcmp(tmp, string, true) == 0)
{
giveplayerid = i;
Mobile[playerid] = giveplayerid;
if(IsPlayerConnected(giveplayerid))
{
if(PhoneOff[giveplayerid])
{
SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] That person's cellphone is turned off.");
return 1;
}
if (Mobile[giveplayerid] == 2550)
{
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerActionMessage(playerid,20.0,"takes out his cellphone.");
}
else
{
PlayerActionMessage(playerid,20.0,"takes out her cellphone.");
}
format(string, sizeof(string), "[SERVER:] Your phone is ringing; Caller: %s ( %d )", GetPlayerNameEx(playerid),PlayerInfo[playerid][pPhoneNumber]);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
PlayerActionMessage(giveplayerid,20.0,"'s phone begins to ring.");
StartedCall[playerid] = 1;
if(!IsPlayerInAnyVehicle(playerid))
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
}
StartedCall[giveplayerid] = 0;
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] That person is on the phone.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] Invalid phone number.");
return 1;
}
}
}