Adding vehicles
#1

Removed
Reply
#2

You can use AddStaticVehicle or AddStaticVehicleEx on OnGameModeInit.
Reply
#3

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == ServerVehicle[0])
    {
        SendClientMessage(playerid, -1, "Welcome to Server Vehicle 0");
    }
    return 1;
}
Reply
#4

Removed
Reply
#5

Quote:
Originally Posted by Fernado Samuel
Посмотреть сообщение
By adding this line, it will show the message only when i enter the vehicle id 0 know?
Yup. You want the message to appear for all of them?
Reply
#6

Removed
Reply
#7

dumb!
Reply
#8

1.) It's bump (bring up my post), not dumb (~stupid).

2.) Do not bump within a few hours, please.

3.) Code below:

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    for(new i=0; i<sizeof(ServerVehicle); i++)
    {
        if(vehicleid == ServerVehicle[i])
        {
            SendClientMessage(playerid, -1, "Welcome to a Server Vehicle!");
        }
    }
    return 1;
}
Reply
#9

better to use this code. OnPlayerEnterVehicle gets called too soon to be of much use to anyone in this application.

pawn Код:
public OnPlayerStateChange(playerid, newtstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER) {
    new vehicleid = GetPlayerVehicleID(playerid),string[MAX_STRING];
        for(new i=0; i<sizeof(ServerVehicle); i++) {
            if(vehicleid == ServerVehicle[i]) {
                format(string,sizeof(string),"This is a Server Vehicle. \n-= Server ID: %d <> Vehicle ID: %d =-", i, vehicleid);
                GameTextForPlayer(playerid, string, 3000, 1);
                return 1;
            }
        }
    }
    return 0;
}
this will be called when the player sits in the car and not when you hit the entry button. basically its a bit safer and avoids having problems later on down the line. The code above woill also print out which server array id the vehicle has and which vehicleid the vehicle has.
Reply
#10

Removed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)