SA-MP Forums Archive
/enter and /exit using KEY_SECONDARY_ATTACK key - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /enter and /exit using KEY_SECONDARY_ATTACK key (/showthread.php?tid=481841)



/enter and /exit using KEY_SECONDARY_ATTACK key - mrxqware - 17.12.2013

Is there a way to use the same KEY_SECONDARY_ATTACK to exit?

I've tried this, but it does not work. I can enter. But not exit using the same key.

Quote:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{


if( newkeys & KEY_SECONDARY_ATTACK ){
return OnPlayerCommandText(playerid, "/enter");

// return true;
}

if( newkeys & KEY_SECONDARY_ATTACK ){
return OnPlayerCommandText(playerid, "/exit");

// return true;
}




Re: /enter and /exit using KEY_SECONDARY_ATTACK key - Pottus - 17.12.2013

Obviously it never gets a chance to call /exit try it like this, it shouldn't exit even though you try because your position won't be fully updated if it does then you'll have to try some other stuff but it should work I would think.

pawn Код:
if( newkeys & KEY_SECONDARY_ATTACK ){
    OnPlayerCommandText(playerid, "/enter");
    OnPlayerCommandText(playerid, "/exit");
}



Re: /enter and /exit using KEY_SECONDARY_ATTACK key - mrxqware - 18.12.2013

Ty it's working! Rep+