[Tutorial] How to make: Your own airbreak command for faster travelling!
#2

First of all, you didn't defined pAdmin. Maybe other players have different enums. Anyway, this code it's very bad optimized.
This could be good by pressing keys, this it's more efficiently and works better.
To be more realistic you should put an Animation or a Special Action with parachute.

This code (you get idea) should be better:

pawn Код:
#include <a_samp>
#include <zcmd>
 
//------------------------------------------------------------------------------
 
new bool:SupermanActivated[MAX_PLAYERS];
 
//------------------------------------------------------------------------------
 
CMD:superman(playerid, params[])
{
    if(SupermanActivated[playerid] == false)
    {
        SupermanActivated[playerid] = true;
        SendClientMessage(playerid, -1, "{FF0000}[SUPERMAN]: {FFFFFF}You activated {FF0000}Superman's Mod.");
    }
    else if(SupermanActivated[playerid] == true)
    {
        SupermanActivated[playerid] = false;
        SendClientMessage(playerid, -1, "{FF0000}[SUPERMAN]: {FFFFFF}You dezactivated {FF0000}Superman's Mod.");
    }
    return 1;
}
 
//------------------------------------------------------------------------------
 
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(SupermanActivated[playerid] == true)
    {
        if(newkeys && KEY_SPRINT)
        {
            SetPlayerPos(playerid, X, Y, Z+10);
        }
        else if(newkeys && KEY_JUMP)
        {
            SetPlayerPos(playerid, X, Y, Z-10);
        }
        //(........)
    }
    return 1;
}
Codes:

- www.pastebin.com;
- Keys;
- OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)