C_far icon

/bk (+ /v) | zcmd + sscanf + y_va

C_far | PRO | 01/27/18 03:01:04 PM UTC | 0 ⭐ | 7832 👁️ | Never ⏰ | []
Pawn |

3.04 KB

|

None

|

0 👍

/

0 👎

#pragma compat 1
 
#include "a_samp"
 
#undef MAX_PLAYERS
#define MAX_PLAYERS 5
 
#include "zcmd"
#include "sscanf2"
#include "YSI\y_va"
 
#define INFINITY (Float:0x7F800000)
 
#define Scm_Params (3)
 
// native Scm(playerid, color, const fmat[], ...);
stock Scm(playerid, color, const fmat[], va_args<>)
{ 
    if(numargs() == Scm_Params) return SendClientMessage(playerid, color, fmat);
 
    static 
        str[145];
        
    va_format(str, sizeof(str), fmat, va_start<Scm_Params>);    
    return SendClientMessage(playerid, color, str); 
}
 
#define Sce(%0,%1) Scm(%0, 0xAA0000FF, "ERREUR{FFFFFF}: "%1)
#define Scu(%0,%1) Scm(%0, 0xAA0000FF, "USAGE{AAAAAA}: "%1)
 
main()
{
 
}
 
//--------------------------------------------------------------------------------------
 
public OnGameModeInit()
{
    SetGameModeText("GM: TutoVideo");
    ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
 
    return true;
}
 
public OnPlayerSpawn(playerid)
{   
    SetPlayerHealth(playerid, INFINITY);
    SetPlayerPos(playerid, 2032.1702, 1344.1896, 10.8203);
    SetPlayerFacingAngle(playerid, 270.1425);
    SetPlayerColor(playerid, -1);
    SetPlayerSkin(playerid, 252);
    
    return true;
}
 
new bool:bk_actived[MAX_PLAYERS];
new bool:bk[MAX_PLAYERS];
new timer_bk[MAX_PLAYERS];
 
forward Timer_BK(playerid);
public Timer_BK(playerid)
{
    new 
        Float:x,
        Float:y,
        Float:z;
 
    GetPlayerPos(playerid, x, y, z);
 
    if(bk[playerid])
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                SetPlayerMapIcon(i, playerid, x, y, z, 20, 0, MAPICON_GLOBAL);
            }
        }
    }
 
    else
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                SetPlayerMapIcon(i, playerid, x, y, z, 30, 0, MAPICON_GLOBAL);
            }
        }
    }
 
    bk[playerid] = !bk[playerid];
 
    return true;
}
 
//--------------------------------------------------------------------------------------
 
CMD:bk(playerid, params[])
{
    bk_actived[playerid] = !bk_actived[playerid];
 
    if(bk_actived[playerid])
    {
        new 
            Float:x,
            Float:y,
            Float:z;
 
        GetPlayerPos(playerid, x, y, z);
 
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                SetPlayerMapIcon(i, playerid, x, y, z, 20, 0, MAPICON_GLOBAL);
            }
        }
 
        bk[playerid] = false;
        timer_bk[playerid] = SetTimerEx("Timer_BK", 50, true, "d", playerid);
    }
 
    else
    {
        KillTimer(timer_bk[playerid]);
        
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                RemovePlayerMapIcon(i, playerid);
            }
        }
    }
 
    return true;
}
 
CMD:v(playerid, params[])
{
    new
        modelid;
 
    if(sscanf(params, "d", modelid)) return Scu(playerid, "/v [Modèle ID: 400 - 611]");
    if(!(400 <= modelid <= 611)) return Sce(playerid, "Modèle ID: 400 - 611");
    
    new
        Float:x,
        Float:y,
        Float:z,
        Float:a;
        
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    
    new
        vehicleid = CreateVehicle(modelid, x, y, z, a, random(256), random(256), 10000);
        
    Scm(playerid, -1, "ID du véhicule : %d", vehicleid);
    
    return true;
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎