Only Admin Car
#1

How car i make so only admins can drive these cars?
And
How do i add NOS? I have added 10x nos in MTA but when ill go ingame, it has not NOS


Here is an example script:
pawn Код:
#include <a_samp>

#define FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print(" Example By Larsey123");
    print("-------------------------------------------\n");

    //Vehicles
    AddStaticVehicleEx(562,927.07006836,2083.21264648,10.57386208,180.00000000,-1,1,15); //Elegy
    AddStaticVehicleEx(562,930.43939209,2083.34375000,10.57386208,180.00000000,-1,1,15); //Elegy
    AddStaticVehicleEx(562,933.63378906,2083.46875000,10.57386208,180.00000000,-1,1,15); //Elegy
    AddStaticVehicleEx(562,937.17858887,2083.60742188,10.57386208,180.00000000,-1,1,15); //Elegy
    AddStaticVehicleEx(562,940.72326660,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
    AddStaticVehicleEx(562,944.45129395,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
   
    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Whatever", cmdtext, true) == 0)
    {
        if(IsPlayerAdmin(playerid)==1)
        {
            SetPlayerPos(playerid,983.2335,2133.0151,10.8203);
        }
        return 1;
        }
    return 0;
}
Reply
#2

do
Код:
car1 = AddStaticVehicleEx(562,927.07006836,2083.21264648,10.57386208,180.00000000,-1,1,15); //Elegy
top of script put
Код:
new car1;
then under OnPlayerEnterVehicle function, check if they are admin and check if its that car.
Reply
#3

So it should look like this? But what to type under
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)

pawn Код:
#include <a_samp>

#define FILTERSCRIPT

new car1;

public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print(" Example By Larsey123");
    print("-------------------------------------------\n");

    //Vehicles
    car1 = AddStaticVehicleEx(562,927.07006836,2083.21264648,10.57386208,180.00000000,-1,1,15); //Elegy
    car1 = AddStaticVehicleEx(562,930.43939209,2083.34375000,10.57386208,180.00000000,-1,1,15); //Elegy
    car1 = AddStaticVehicleEx(562,933.63378906,2083.46875000,10.57386208,180.00000000,-1,1,15); //Elegy
   
    return 1;
}


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}
Reply
#4

Bwah if you want Nitros for all cars dont make variables or smth like that, create another function.
ofcourse this can be done with admin cars too.. But make admincars in first then create other cars because you will need to count how many admin cars you have.

pawn Код:
stock AddCar(model,Float:x,Float:y,Float:z,Float:a,color1,color2,time)
{
     static vehicleid;
     vehicleid = AddStaticVehicleEx(model,Float:x,Float:y,Float:z,Float:a,color1,color2,time);
     AddVehicleComponent(vehicleid,1010);
     //dnt remember if there is needed a return value.
}
After that, you should add at OnVehicleRespawn.
pawn Код:
if(vehicleid >= 1 && vehicleid <= youradmincars+1)
{
     AddVehicleComponen(vehicleid,1010);
}
Nex probably you want allow to enter only admin

So at OnPlayerEnterVehicle
pawn Код:
static vehicleid = GetPlayerVehicleId(playerid);
if(vehicleid >= 1 && vehicleid <= youradmincars+1)
{
     if(isAdmin or your values) { }
     else { static Float:x, Float:y, Float:z; GetPlayerPos(playerid,x,y,z);SetPlayerPos(playerid,x,y,z); return 0;}
} // return 0 at else should not allow to stream it to other players i dnt know ;D
Hope you understood, ofcourse maybe there are some mistakes so wathout by yourself.
Reply
#5

-.- I dident understand, i am new with scripting so...

Can someone make a script for me?

I want Nitro and Only Admins can use these cars

pawn Код:
AddStaticVehicleEx(562,933.63378906,2083.46875000,10.57386208,180.00000000,-1,1,15); //Elegy
AddStaticVehicleEx(562,937.17858887,2083.60742188,10.57386208,180.00000000,-1,1,15); //Elegy
AddStaticVehicleEx(562,940.72326660,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
AddStaticVehicleEx(562,944.45129395,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
AddStaticVehicleEx(562,948.27990723,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
Reply
#6

Top of script
pawn Код:
new AdminCar[5];
onGameModeInit
pawn Код:
AdminCar[0] = AddStaticVehicleEx(562,933.63378906,2083.46875000,10.57386208,180.00000000,-1,1,15); //Elegy
AdminCar[1] = AddStaticVehicleEx(562,937.17858887,2083.60742188,10.57386208,180.00000000,-1,1,15); //Elegy
AdminCar[2] = AddStaticVehicleEx(562,940.72326660,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
AdminCar[3] = AddStaticVehicleEx(562,944.45129395,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
AdminCar[4] = AddStaticVehicleEx(562,948.27990723,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
onVehicleSpawn
pawn Код:
for(new i, j = sizeof(AdminCar); i < j; i++)
{
    if(AdminCar[i] == vehicleid)
    {
        AddVehicleComponent(vehicleid, 1010);
        break;
    }
}
onPlayerEnterVehicle
pawn Код:
for(new i, j = sizeof(AdminCar); i < j; i++)
{
    if(AdminCar[i] == vehicleid)
    {
        if(!IsPlayerAdmin(playerid))
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0xFFFFFFFF, "You are not an Admin!");
        }
        break;
    }
}
Untested.
Reply
#7

pawn Код:
#include <a_samp>

new adminveh1;
new adminveh2;
new adminveh3;
new adminveh4;
new adminveh5;
new adminveh6;

public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print(" Example By Larsey123");
    print("-------------------------------------------\n");

    //Vehicles
    adminveh1 = AddStaticVehicleEx(562,927.07006836,2083.21264648,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh2 = AddStaticVehicleEx(562,930.43939209,2083.34375000,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh3 = AddStaticVehicleEx(562,933.63378906,2083.46875000,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh4 = AddStaticVehicleEx(562,937.17858887,2083.60742188,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh5 = AddStaticVehicleEx(562,940.72326660,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh6 = AddStaticVehicleEx(562,944.45129395,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy

    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Whatever", cmdtext, true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            SetPlayerPos(playerid,983.2335,2133.0151,10.8203);
            return 1;
        }
        return 0;
    }
    return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(vehicleid == adminveh1 || adminveh2 || adminveh3 || adminveh4 ||adminveh5 || adminveh6)
        {
            if(IsPlayerAdmin(playerid))
            {
                AddVehicleComponent(vehicleid,1010);
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
                PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
                GameTextForPlayer(playerid, "~w~This is an ~r~Admin ~w~only vehicle!", 3000, 3);
            }
        }
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by Th3Angel
Посмотреть сообщение
pawn Код:
#include <a_samp>

new adminveh1;
new adminveh2;
new adminveh3;
new adminveh4;
new adminveh5;
new adminveh6;

public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print(" Example By Larsey123");
    print("-------------------------------------------\n");

    //Vehicles
    adminveh1 = AddStaticVehicleEx(562,927.07006836,2083.21264648,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh2 = AddStaticVehicleEx(562,930.43939209,2083.34375000,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh3 = AddStaticVehicleEx(562,933.63378906,2083.46875000,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh4 = AddStaticVehicleEx(562,937.17858887,2083.60742188,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh5 = AddStaticVehicleEx(562,940.72326660,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh6 = AddStaticVehicleEx(562,944.45129395,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy

    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Whatever", cmdtext, true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            SetPlayerPos(playerid,983.2335,2133.0151,10.8203);
            return 1;
        }
        return 0;
    }
    return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(vehicleid == adminveh1 || adminveh2 || adminveh3 || adminveh4 ||adminveh5 || adminveh6)
        {
            if(IsPlayerAdmin(playerid))
            {
                AddVehicleComponent(vehicleid,1010);
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
                PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
                GameTextForPlayer(playerid, "~w~This is an ~r~Admin ~w~only vehicle!", 3000, 3);
            }
        }
    }
    return 1;
}
That makes all vehecles on the server to admin vehicles :S I just want to make the elegy's to admin
Reply
#9

Whooops... My Bad.
pawn Код:
#include <a_samp>

new adminveh1;
new adminveh2;
new adminveh3;
new adminveh4;
new adminveh5;
new adminveh6;

public OnFilterScriptInit()
{
    print("\n-----------------------------------------");
    print(" Example By Larsey123");
    print("-------------------------------------------\n");

    //Vehicles
    adminveh1 = AddStaticVehicleEx(562,927.07006836,2083.21264648,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh2 = AddStaticVehicleEx(562,930.43939209,2083.34375000,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh3 = AddStaticVehicleEx(562,933.63378906,2083.46875000,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh4 = AddStaticVehicleEx(562,937.17858887,2083.60742188,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh5 = AddStaticVehicleEx(562,940.72326660,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy
    adminveh6 = AddStaticVehicleEx(562,944.45129395,2083.73437500,10.57386208,180.00000000,-1,1,15); //Elegy

    return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Whatever", cmdtext, true) == 0)
    {
        if(IsPlayerAdmin(playerid))
        {
            SetPlayerPos(playerid,983.2335,2133.0151,10.8203);
            return 1;
        }
        //return 0;
    }
    return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(vehicleid == adminveh1 || vehicleid == adminveh2 || vehicleid == adminveh3 || vehicleid == adminveh4 || vehicleid == adminveh5 || vehicleid == adminveh6)
        {
            if(IsPlayerAdmin(playerid))
            {
                AddVehicleComponent(vehicleid,1010);
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
                PlayerPlaySound(playerid, 1147, 0.0, 0.0, 0.0);
                GameTextForPlayer(playerid, "~w~This is an ~r~Admin ~w~only vehicle!", 3000, 3);
            }
        }
    }
    return 1;
}
Reply
#10

Thank You!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)