SendClientMessage won't display
#1

Hello,
maybe someone can look after this code. As the Title of this Thread says, the SendClientMessage won't show. I want to display 2x SendCliendMessage, for if false, and if true. I know, i forgot here something, but it seems everything okey.

Код HTML:
if( newkeys == KEY_SECONDARY_ATTACK )
{
    if( IsPlayerInRangeOfPoint( playerid, 2.0, 24.2823,17.6228,45.3920) )
    {
        if (playerDB[playerid][worker] == 0) // False
        {  
            SetPlayerPos( playerid,-18.9894,-91.7774,35.1484);
            SetPlayerInterior( playerid, 0 ); 
            SendClientMessage(playerid, ORANGE, "You can't get in. Get a Job!"); // This SendClientMessage won't show
            return 1;
        }
    SetPlayerPos( playerid,-11.9894,-97.7774,35.1484);
    SetPlayerInterior( playerid, 0 ); 
    SendClientMessage(playerid, ORANGE, "Welcome.");
    return 1;
    }
}
Thanks.
Reply
#2

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

Quote:
How NOT to check for a key

Let's presume that you want to detect when a player presses their FIRE button, the obvious code would be:
Код:
if (newkeys == KEY_FIRE)
This code may even work in your testing, but it is wrong and your testing is insufficient. Try crouching and pressing fire - your code will instantly stop working. Why? Because "newkeys" is no longer the same as "KEY_FIRE", it is the same as "KEY_FIRE" COMBINED WITH "KEY_CROUCH".

Quote:
How to check for a key

So, if the variable can contain multiple keys at once, how do you check for just a single one? The answer is bit masking. Each key has its own bit in the variable (some keys have the same bit, but they are onfoot/incar keys, so can never be pressed at the same time anyway) and you need to check for just that single bit:
Код:
if (newkeys & KEY_FIRE)
As for your problem, I don't know. Is the teleport working but the message not sending?
Reply
#3

Yep, only the SendClientMessage won't show. Teleport is Working. Only shows the second SendClientMessage ž "Welcome". For example if i'm not a worker, it won't send a message, but if i am, it sends "Welcome".
Reply
#4

I'm just trying hard at this point, but try inverting the orders of it, I doubt it'll work tho:

Код:
            SendClientMessage(playerid, ORANGE, "You can't get in. Get a Job!");
            SetPlayerPos( playerid,-18.9894,-91.7774,35.1484);
            SetPlayerInterior( playerid, 0 );
Reply
#5

Thank you, but seems not working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)