Restricted Vehicle Trouble?
#1

Ok this is my Restricted Vehicle code so only 1 Team may use this one vehicle:



Код:
new restrictedvehicle;

public OnGameModeInit()
{
restrictedvehicle = CreateVehicle(520,-1438.48168945,-932.98889160,202.38511658,270.00000000,-1,-1,120); //Hydra
restrictedvehicle = CreateVehicle(520,-1452.54101562,-926.71038818,202.62852478,270.00000000,-1,-1,120); //Hydra
restrictedvehicle = CreateVehicle(520,-1461.35107422,-917.00463867,203.01586914,270.00000000,-1,-1,120); //Hydra
restrictedvehicle = CreateVehicle(520,-1445.40063477,-916.93469238,203.06689453,270.00000000,-1,-1,120); //Hydra
restrictedvehicle = CreateVehicle(520,-1433.76928711,-922.97772217,202.83015442,270.00000000,-1,-1,120); //Hydra
return 1;
}

public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerTeam(playerid) != CLASS_MERC && GetPlayerVehicleID(playerid) == restrictedvehicle)
        {
        SendClientMessage(playerid,RED,"[ATT]:Type /airstrike Airbourne For Airstrikes At Your Demand!(Cost 1000 Fuel!");
        }
        else
        {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid,RED,"[ATT]:You Are Not Aloud To Drive This Vehicle!(Merc's Only)");
        }
    }
    return 1;
}
And when ever another team member uses any vehicle thats not restricted thay get this message :S

Код:
SendClientMessage(playerid,RED,"[ATT]:You Are Not Aloud To Drive This Vehicle!(Merc's Only)");
Please tell me what am i doing wrong

:S
Reply
#2

It happened to me too trying to help a guy.. im asking too
Reply
#3

I am joining this problem, but i will try to help.
Reply
#4

get these errors:

Код:
C:\Users\Weponz\Desktop\Server Files\gamemodes\M-SAIF.pwn(219) : error 028: invalid subscript (not an array or too many subscripts): "restrictedvehicle"
C:\Users\Weponz\Desktop\Server Files\gamemodes\M-SAIF.pwn(219) : warning 215: expression has no effect
C:\Users\Weponz\Desktop\Server Files\gamemodes\M-SAIF.pwn(219) : error 001: expected token: ";", but found "]"
C:\Users\Weponz\Desktop\Server Files\gamemodes\M-SAIF.pwn(219) : error 029: invalid expression, assumed zero
C:\Users\Weponz\Desktop\Server Files\gamemodes\M-SAIF.pwn(219) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

I edited the code to fit mine but it slill tells me i am not in that org.

pawn Код:
new sapd[8];
pawn Код:
sapd[0] = AddStaticVehicle(598,2256.2041,2476.9424,10.5694,356.1667,0,1); // policecar
    sapd[1] = AddStaticVehicle(598,2256.2522,2442.7004,10.5722,358.7384,0,1); // policecar
    sapd[2] = AddStaticVehicle(598,2269.4016,2476.6553,10.5733,358.4040,0,1); // policecar2
    sapd[3] = AddStaticVehicle(596,2269.4478,2441.5247,10.6808,176.6156,0,1); // policecar4
    sapd[4] = AddStaticVehicle(427,2277.5825,2477.3967,10.9522,0.1354,1,2); // spadenforcer
    sapd[5] = AddStaticVehicle(528,2278.3333,2441.9409,10.8645,179.2752,0,0); // fbitrucksapd
    sapd[6] = AddStaticVehicle(601,2291.1401,2443.5559,10.5791,1.0332,1,1); // swatsapd
    sapd[7] = AddStaticVehicle(490,2510.3882,2389.3213,10.9475,271.2535,0,0);
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new playerState = GetPlayerState(playerid);
    new vid = GetPlayerVehicleID(playerid);
    if (playerState == PLAYER_STATE_DRIVER)
    {
    for(new i = 0; i < sizeof(sapd); i++)
    if(OrgId[playerid] != 1 || vid == sapd[i] || vid == sapd[i] || vid == sapd[i] || vid ==  sapd[i] || vid ==  sapd[i] || vid ==  sapd[i] || vid ==  sapd[i] || vid ==  sapd[i])
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid,red,"This is an organization Vehicle");
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Firez
Посмотреть сообщение
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new state = GetPlayerState(playerid);
    new vid = GetPlayerVehicleID(playerid);
    if(state == PLAYER_STATE_DRIVER)
    {
        for(new i = 0; i < sizeof(sapd); i++)
        {
            if(OrgId[playerid] != 1 && vid == sapd[i]])
            {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,red,"This Is For Organization 1 Online");
            }
        }
    }
    return 1;
}
tee do what i did for weaponz below here
pawn Код:
new Float:RVPositions[5][5] = {
    {520,-1438.48168945,-932.98889160,202.38511658,270.00000000},//modelid,x,y,z,angle
    {520,-1452.54101562,-926.71038818,202.62852478,270.00000000},
    {520,-1461.35107422,-917.00463867,203.01586914,270.00000000},
    {520,-1445.40063477,-916.93469238,203.06689453,270.00000000},
    {520,-1433.76928711,-922.97772217,202.83015442,270.00000000}
};
new restrictedvehicle[5];
public OnGameModeInit()
{
    for(new i = 0; i < sizeof(restrictedvehicle); i++)
    {
        restrictedvehicle[i] = CreateVehicle(RVPositions[i][0], RVPositions[i][1], RVPositions[i][2],RVPositions[i][3],RVPositions[i][4],-1,-1,120); //Hydra
    }
    return 1;
}
I use all that code?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)