Help With ClientMessage
#1

I have create this all work nothing not work but the problem is when i get the lift down its give me message

Lift Going Down


but when i press F Key again to make him go up its go but he send me 2 of clientmessags


Lift Going Down
Lift Going Up


like this how i can make him when i press F againt o make lift up send only this message


Lift Going Up

Help me!

Код:
	if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && PRESSED(KEY_SECONDARY_ATTACK))
	{
	    new Float:x,Float:y,Float:z;
		GetPlayerPos(playerid,x,y,z);
		if(gTeam[playerid] == TEAM_ARMY && x >= 999.9721 && x <= 1029.7795 && y >= -2351.1658 && y <= -2321.1563)
		{
			MoveObject(lift1,1013.67, -2338.25, 11.59,3);
			SendClientMessage(playerid, COLOR_GREEN,"Lift Going Down");

		}
	 	if(gTeam[playerid] == TEAM_ARMY && x >= 999.9721 && x <= 1029.7795 && y >= -2351.1658 && y <= -2321.1563)
		{

		    GetObjectPos(lift1,x,y,z);
			if(x == 1013.67 && y == -2338.25 && z == 11.59)
			{
	    		MoveObject(lift1,1013.67, -2338.25, 18.62,3);
				SendClientMessage(playerid, COLOR_GREEN,"Lift Going Up");
		

	    
			}

		}

	}
Reply
#2

Alright, Before i was trying to make two objects controllable with bind keys, Here you go you might get an example from this i hope.

pawn Код:
#include <a_samp>
#include <zcmd>

new FlyDs[MAX_PLAYERS];
new FlyPs[MAX_PLAYERS];
new obj1;
new obj2;


#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
   
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" ..  ..");
    print("--------------------------------------\n");
    return 1;
}

#endif

public OnGameModeInit()
{
    obj1 = CreateObject(16771,-1175.88977051,-302.76074219,23.08684540,0.00000000,0.00000000,332.71545410); //Des_Savhangr
    obj2 = CreateObject(8493,-992.20349121,10.18408966,17.33088875,0.00000000,0.00000000,0.00000000); //PirateShip
    return 1;
}

public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, 0x33AA33AA, "Please type /Flyds if you want to fly Des_savhangr.");
    SendClientMessage(playerid, 0x33AA33AA, "Please type /Flyps if you want to fly PirateShip.");
    FlyDs[playerid] = 0;
    FlyPs[playerid] = 0;
    return 1;
}

//Cmds


COMMAND:flyds(playerid, params[])
{
    SendClientMessage(playerid, 0x33AA33AA, "You're now alloweded to fly the Des_savhangr, Please type /Flyingkeys to see list of keys to move.");
    SendClientMessage(playerid, 0x33AA33AA, "You can now park Planes, Vehicles etc inside the Des_savhangr.");
    FlyDs[playerid] = 1;
    SetPlayerFacingAngle( playerid, 270 );
    return 1;
}

COMMAND:offflyds(playerid, params[])
{
    SendClientMessage(playerid, 0x33AA33AA, "You're now not disalloweded to fly the Des_savhangr , Please type /Fly again if you want to fly Des_savhangr.");
    FlyDs[playerid] = 0;
    return 1;
}

COMMAND:flyps(playerid, params[])
{
    SendClientMessage(playerid, 0x33AA33AA, "You're now alloweded to fly the PirateShip, Please type /Flyingkeys to see list of keys to move.");
    FlyPs[playerid] = 1;
    SetPlayerFacingAngle( playerid, 270 );
    return 1;
}

COMMAND:offflyps(playerid, params[])
{
    SendClientMessage(playerid, 0x33AA33AA, "You're now not disalloweded to fly the PirateShip , Please type /Flyps again if you want to fly PirateShip.");
    FlyPs[playerid] = 0;
    return 1;
}


COMMAND:flyingkeys(playerid, params[])
{
    SendClientMessage(playerid, 0x33AA33AA, "Move Up: ( SHIFT ) .. Move Down: ( Left Mouse Button )");
    SendClientMessage(playerid, 0x33AA33AA, "Move Left: ( Alphabet C ) .. Move Right: ( Mouse Middle Circle Button.)");
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

//Des Savhangr

     //.. Key Up ..
    if(FlyDs[playerid] == 1){
     if(PRESSED(KEY_JUMP)) {
        new Float:x,Float:y,Float:z;
        MoveObject(obj1, x, y, z + 10, 4.00);
        SendClientMessage(playerid, 0x33AA33AA, "Object: Des_savhangr moved 10 meters Up!");
        }
    }
     // .. Key Down ..
    if(FlyDs[playerid] == 1){
     if(PRESSED(KEY_FIRE)) {
        new Float:x,Float:y,Float:z;
        MoveObject(obj1, x, y, z - 10, 4.00);
        SendClientMessage(playerid, 0x33AA33AA, "Object: Des_savhangr moved 10 meters Down!");
        }
    }
     //.. Key Left ..
    if(FlyDs[playerid] == 1){
     if(PRESSED(KEY_CROUCH)) {
        new Float:x,Float:y,Float:z;
        MoveObject(obj1, x, y + 10, z, 4.00);
        SendClientMessage(playerid, 0x33AA33AA, "Object: Des_savhangr moved 10 meters Left!");
        }
    }
     //.. Key Right ..
    if(FlyDs[playerid] == 1){
     if(PRESSED(KEY_LOOK_BEHIND)) {
        new Float:x,Float:y,Float:z;
        MoveObject(obj1, x, y - 10, z, 4.00);
        SendClientMessage(playerid, 0x33AA33AA, "Object: Des_savhangr moved 10 meters Right!");
        }
    }
   
//PirateShip

     //.. Key Up ..
    if(FlyPs[playerid] == 1){
     if(PRESSED(KEY_JUMP)) {
        new Float:x,Float:y,Float:z;
        MoveObject(obj2, x, y, z + 10, 4.00);
        SendClientMessage(playerid, 0x33AA33AA, "Object: PirateShip moved 10 meters Up!");
        }
    }
     //.. Key Down ..
    if(FlyPs[playerid] == 1){
     if(PRESSED(KEY_FIRE)) {
        new Float:x,Float:y,Float:z;
        MoveObject(obj1, x, y, z - 10, 4.00);
        SendClientMessage(playerid, 0x33AA33AA, "Object: PirateShip moved 10 meters Down!");
        }
    }
     //.. Key Left ..
    if(FlyPs[playerid] == 1){
     if(PRESSED(KEY_CROUCH)) {
        new Float:x,Float:y,Float:z;
        MoveObject(obj1, x, y + 10, z, 4.00);
        SendClientMessage(playerid, 0x33AA33AA, "Object: PirateShip moved 10 meters Left!");
        }
    }
     //.. Key Right ..
    if(FlyPs[playerid] == 1){
     if(PRESSED(KEY_LOOK_BEHIND)) {
        new Float:x,Float:y,Float:z;
        MoveObject(obj1, x, y - 10, z, 4.00);
        SendClientMessage(playerid, 0x33AA33AA, "Object: PirateShip moved 10 meters Right!");
        }
    }
    return 1;
}
Thanks!
Reply
#3

thanks man you are realy nice
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)