Skip to content

Instantly share code, notes, and snippets.

Created March 4, 2015 13:55
Show Gist options
  • Save anonymous/81b132445e35df3a4681 to your computer and use it in GitHub Desktop.
Save anonymous/81b132445e35df3a4681 to your computer and use it in GitHub Desktop.
#include <a_samp>
main(){print("loaded...");}
enum {
PICK,
LEAVE,
}
new bool:jetpackDetected[MAX_PLAYERS char] = {false, ...};
public OnPlayerUpdate(playerid) {
if (GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) {
if(!jetpackDetected{playerid}) {
jetpackDetected{playerid} = !jetpackDetected{playerid};
onJetpack(PICK, playerid);
}
}
else if (jetpackDetected{playerid}) {
jetpackDetected{playerid} = !jetpackDetected{playerid};
onJetpack(LEAVE, playerid);
}
}
forward onJetpack(action, playerid);
public onJetpack(action, playerid) {
SendClientMessage(playerid, -1, action == PICK ?("you've picked up the jetpack") : ("you've left your jetpack"));
}
public OnPlayerCommandText(playerid, cmdtext[]) {
if (!strcmp(cmdtext, "/jp")) {
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment