Admin CMD /allrampoff /allrampon
#1

Hey,

I've got this ramp spawner

http://forum.sa-mp.com/index.php?topic=41866.0

PAWN Code:
pawn Код:
#include <a_samp>
#define red 0xFF0000AA
#define green 0x00FF00AA

new Pressedkey[MAX_PLAYERS] = {false, ...};
new jumped[MAX_PLAYERS] = {-1, ...};
new ramped[MAX_PLAYERS];
new noramp[MAX_PLAYERS];
forward Keys();
forward DeleteRamp(playerid);
forward Float:GetRampDistance(playerid);
forward Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance);

public OnFilterScriptInit()
{
    SetTimer("Keys", 100, 1);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp("/ramphelp ", cmdtext, true, 9) == 0)
    {
    SendClientMessage(playerid, red, "Ramp Help");
    SendClientMessage(playerid, green, "Type /rampon to turn ramp spawning on.");
    SendClientMessage(playerid, green, "Type /rampoff to turn ramp spawning off.");
    SendClientMessage(playerid, green, "Press STRG/Secundary Weap button to spawn a ramp.");
    return 1;
    }
    if (strcmp("/rampoff ", cmdtext, true, 8) == 0)
    {
        ramped[playerid] = 1;
        noramp[playerid] = 1;
        SendClientMessage(playerid, red, "You have turned ramp spawning off!");
        SendClientMessage(playerid, red, "Type /rampon to turn it back on!");
        return 1;
    }
    if (strcmp("/rampon ", cmdtext, true, 7) == 0)
    {
        ramped[playerid] = 0;
        noramp[playerid] = 0;
        SendClientMessage(playerid, red, "You have turned ramp spawning back on!");
        SendClientMessage(playerid, red, "Type /rampoff to turn it back off!");
        return 1;
    }
    return 0;
}

public Keys()
{
    new keys, jump, updown, playerid;
    new Float:x, Float:y, Float:z, Float:angle;
    for (playerid = 0; playerid < MAX_PLAYERS; playerid++) {
      if (IsPlayerConnected(playerid)) {
            GetPlayerKeys(playerid, keys, jump, updown);
            if(ramped[playerid] == 1 && noramp[playerid] == 1)
            {

            }
            else if(ramped[playerid] == 1)
            {
           
            }
            else if (keys & KEY_ACTION&& IsPlayerInAnyVehicle(playerid)) {{
                      GetPlayerPos(playerid, x, y, z);
                      angle = GetPosInFrontOfPlayer(playerid, x, y, GetRampDistance(playerid));
                      jumped[playerid] = CreateObject(1632, x, y, z - 0.5, 0.0, 0.0, angle);
                      ramped[playerid] = 1;
                      SetTimerEx("DeleteRamp", 1000, 0, "d", playerid);
                  }
              }
            } else Pressedkey[playerid] = false;
        }
}

public DeleteRamp(playerid)
{
    if (jumped[playerid] != -1) {
      DestroyObject(jumped[playerid]);
      jumped[playerid] = -1;
      ramped[playerid]=0;
    }
}

public OnFilterScriptExit()
{
    for (new i=0; i<MAX_PLAYERS; i++)
    {
        if (jumped[i] != -1) DestroyObject(jumped[i]);
    }
}

Float:GetRampDistance(playerid)
{
    new ping = GetPlayerPing(playerid), Float:dist;
    dist = floatpower(ping, 0.25);
    dist = dist*4.0;
    dist = dist+5.0;
    return dist;
}

Float:GetPosInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x, y, a);
    if (IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    else GetPlayerFacingAngle(playerid, a);
    x += (distance * floatsin(-a, degrees));
    y += (distance * floatcos(-a, degrees));
    return a;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    for (new i=0; i<MAX_PLAYERS; i++)
    {
        if (jumped[i] != -1) DestroyObject(jumped[i]);
    }
}

public OnPlayerSpawn(playerid)
{

    return 1;
}

I'm trying to create an Admin command which is able to put this function for ALL players on or off.
I don't know exactly how to

can someone help me, please

Greetz
- XoX
Reply
#2

This is Better ramp choices to.
http://forum.sa-mp.com/index.php?topic=144651.0]

http://forum.sa-mp.com/index.php?topic=144651.0
Reply
#3

thanks i added the ramp styles
but how to make that command
comon dudes help me please!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)