SendClientMessage problem!
#1

I've tried alot of GetClosestPlayer functions and all causes the same problem in SendClientMessage. I really don't know what exactly causes the problem, the GetClosestPlayer function or my arranging of the Scripting Lines.

Look At This:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((newkeys & KEY_LOOK_BEHIND) && !(oldkeys & KEY_LOOK_BEHIND))
    {
        if(PlayerTeam[playerid] == TEAM_CIV && AdminDuty[playerid] == false)
        {
            if(PlayerInfo[playerid][pSkill] == 1)
            {
                new targetid = GetClosestPlayer(playerid, 7.0);
                if(IsKidnapped[playerid] == 1 && Spawned[playerid] == 0) return 1;
                if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[Error:] {FFFFFF}There are no players close enough to rape.");
                //if(GetPlayerWantedLevel(targetid) == 0) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[Error:] {FFFFFF}There are no players close enough to rape.");
                if(Spawned[targetid] == 0 || Freezed[targetid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[Error:] {FFFFFF}There are no players close enough to rape.");
                if(ArrestCuffed[targetid] == 1) return SendClientMessage(playerid, COLOR_RED, "You cannot rape cuffed players.");
            }
        }
    }
    return 1;
}
The Error Message "There are no players close enough to rape." only appears if i make the //Comment Line compilable (uncommented), and doesn't appear if i make it as comment!
How to make the error message appears ? cuz i want to delete all the comment line.

GetClosestPlayer function: (originally posted by nmader)
pawn Код:
stock Float:GetDistanceBetweenPlayers(p1,p2)
{
    new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
    if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
    {
        return -1.00;
    }
    GetPlayerPos(p1,x1,y1,z1);
    GetPlayerPos(p2,x2,y2,z2);
    return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}

stock GetClosestPlayer(playerid, Float:dis)
{
    new x, Float:dis2, player;
    player = -1;
    for (x = 0; x < MAX_PLAYERS; x++)
    {
        if(IsPlayerConnected(x) && x != playerid && GetPlayerState(x) != PLAYER_STATE_SPECTATING)
        {
            dis2 = GetDistanceBetweenPlayers(x,playerid);
            if(dis2 < dis && dis2 != -1.00)
            {
                dis = dis2;
                player = x;
            }
        }
    }
    return player;
}
Reply


Messages In This Thread
SendClientMessage problem! - by Juvanii - 09.07.2014, 21:00
Re: SendClientMessage problem! - by Konstantinos - 09.07.2014, 21:11
Re: SendClientMessage problem! - by Juvanii - 09.07.2014, 21:19
Respuesta: Re: SendClientMessage problem! - by Zume - 09.07.2014, 21:23
Re : SendClientMessage problem! - by S4t3K - 09.07.2014, 21:24
Re: SendClientMessage problem! - by Threshold - 10.07.2014, 01:25
Re: SendClientMessage problem! - by Juvanii - 10.07.2014, 02:10

Forum Jump:


Users browsing this thread: 1 Guest(s)