SA-MP Forums Archive
Cars disapeared - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Cars disapeared (/showthread.php?tid=256891)



Cars disapeared - Kobatz - 22.05.2011

I tried to make some cars only for Army Members,i did it good (i think) complied without any errors..but when i tried to test it IG i couldn't see any vehicle,all dismissed.
This is how i made this.
Код:
enum TeamCars
{
Army
}
@ the top
Код:
new Cars[TeamCars];
under

Then THIs:
Код:
Cars[Army] =  AddStaticVehicle(432,2795.45410156,-2417.37695312,13.73352051,90.00000000,-1,-1); //Rhino
To every car i want
and
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[Army] )
        {
            if(gTeam[playerid] != TEAM_ARMY)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You don't have keys for this vehicle!");
                 return 1;
            }
        }
        return 1;
    }
    return 1;
}
I think i made it good and i think the problem is in AddStaticVehicle .. (i'm using streamer).

Hope someone can help,thanks.


Re: Cars disapeared - ddnbb - 22.05.2011

Quote:
Originally Posted by Kobatz
ПоÑмотреть Ñообщение
I tried to make some cars only for Army Members,i did it good (i think) complied without any errors..but when i tried to test it IG i couldn't see any vehicle,all dismissed.
This is how i made this.
Код:
enum TeamCars
{
Army
}
@ the top
Код:
new Cars[TeamCars];
under

Then THIs:
Код:
Cars[Army] =  AddStaticVehicle(432,2795.45410156,-2417.37695312,13.73352051,90.00000000,-1,-1); //Rhino
To every car i want
and
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[Army] )
        {
            if(gTeam[playerid] != TEAM_ARMY)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You don't have keys for this vehicle!");
                 return 1;
            }
        }
        return 1;
    }
    return 1;
}
I think i made it good and i think the problem is in AddStaticVehicle .. (i'm using streamer).

Hope someone can help,thanks.
Try this:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == 2)
    {
        new CarCheck = GetPlayerVehicleID(playerid);
        if(CarCheck == Cars[Army] )
        {
            if(gTeam[playerid] != TEAM_ARMY)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, COLOR_RED, "You don't have keys for this vehicle!");
            }
        }
    }
    return 1;
}



Re: Cars disapeared - Kobatz - 23.05.2011

Didn't helped. :S

Anyone else?


Re: Cars disapeared - Mean - 23.05.2011

pawn Код:
new cararmy;

public OnGameModeInit( )
{
    cararmy = AddStaticVehicle( 432,2795.45410156,-2417.37695312,13.73352051,90.00000000, 5, 5 );
    return 1;
}

public OnPlayerStateChange( playerid, newstate, oldstate )
{
    if( newstate == PLAYER_STATE_DRIVER )
    {
        if( GetPlayerVehicleID( playerid ) == cararmy && gTeam[ playerid ] != TEAM_ARMY )
        {
            SendClientMessage( playerid, COLOR_RED, "You don't have keys for this vehicle!" );
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Should work.


Re: Cars disapeared - Kobatz - 23.05.2011

I did what u said Mean,complied without any errors,but still i can't see any vehicle IG.


Fking weird. :S

This might help:
I had same problem with objects,when i was creating moving gates.
When i typed Armgate1 = CreateDynamicObject(blbla); it didn't worked(objects were invisble) but later i changed it to Armygate1 = CreateObject = (blabla); and it worked(they were where they should be).


Re: Cars disapeared - Mean - 23.05.2011

Got no friggin idea, the provided code I gave is just tested, and it worked... Maybe you have too many vehicles? Exceeding the limit. Get a streamer if you do.


Re: Cars disapeared - Kobatz - 23.05.2011

I already got streamer. :S :S

O.o :S


Re: Cars disapeared - Mean - 23.05.2011

Ofc, that's why! You can't have streamed and normal AddStaticVehicle vehicles!


Re: Cars disapeared - Kobatz - 23.05.2011

Well,what to do then ? xD


Re: Cars disapeared - Bates - 23.05.2011

AddDynamicVehicle instead of AddStaticVehicle, depending on what streamer you are using.