[Help]SuperJump
#1

Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new SuperJump[MAX_PLAYERS] = 0;
OnPlayerKeysStateChange
Код:
if (PRESSED(KEY_JUMP))
{
if(SuperJump[playerid] == 0) return 0;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z + 10.0);
}
OnPlayerCommandText
Код:
if(strcmp(cmd, "/superjump", true)==0 || strcmp(cmd, "/sj", true)==0)
	{
		if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,COLOR_YELLOW,"* Sorry, only level 3+ Admins can use the superjump commmand.");
		if (SuperJump[playerid] == 0)
		{
			SendClientMessage(playerid, COLOR_GREEN, "* SuperJump ENABLED...");
			SuperJump[playerid] = 1;
			return 1;
		}
		else if(SuperJump[playerid] == 1)
		{
			SendClientMessage(playerid, COLOR_RED, "* SuperJump DISABLED");
			SuperJump[playerid] = 0;
			return 1;
		}
	}
What's wrong
Reply
#2

"What's wrong"

We could actually be asking that from you. You just gave us the code and told nothing about your problem...
Reply
#3

/superjump shoud make me jump high but its not working
Reply
#4

Basically, what your code does, is that when he presses jump he will be teleported into the air above him (like slap command). You could try, when a player types /superjump, then you will set his gravity lower, so he will jump higher. https://sampforum.blast.hk/showthread.php?tid=113485
Reply
#5

Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
and jump key

Код:
if(PRESSED(KEY_JUMP))
    {
    new Float:P[3];
    GetPlayerPos(playerid,P[0],P[1],P[2]);
    GetPlayerVelocity(playerid,P[0],P[1],P[2]);
    SetPlayerVelocity(playerid,P[0],P[1],P[2]+5.0);
    }

	return 1;
}
have fun ! xd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)