San Fierro Trolley car
#1

hello guys, I need a code to put a "trolley car" in motion by San Fierro, thx.
Reply
#2

Trains on SA-MP 0.3 are dependent on tracks, and I don't think the mid-road rails are enabled, making this sadly impossible without client modification/something such as SAMP+ (it doesn't have this functionality and is abandoned, but is a good example of a hacked client -> server and server -> client capability. I also think train spawns may be hardcoded within samp-server.exe).
Reply
#3

Im looking for this exactly:

https://www.youtube.com/watch?v=IRgSc4rCP7A
Reply
#4

Quote:
Originally Posted by bookknp
Посмотреть сообщение
Im looking for this exactly:

https://www.youtube.com/watch?v=IRgSc4rCP7A
I don't know, you can try spawning a trolly model (use AddStaticVehicle) with the position near one of those rails. As I mentioned, trains are coded to spawn on the nearest track. See if that works, didn't think this was possible in SA-MP 0.3.
Reply
#5

Vehicle Model ID: 449

https://sampwiki.blast.hk/wiki/Misc_Vehicles
Reply
#6

Serнa algo como esto

El valor de TRAMID es el id del coche en tu server, el que te de el /dl.

El cуdigo es tan sencillo gracias a la funciуn IsVehicleSeatOccupied, que no es nativa del samp:

pawn Код:
#define TRAMID    VALOR

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/tranvia", true) == 0)
    {
        new Float:x, Float:y, Float:z;
        GetVehiclePos(TRAMID, x, y, z);
        if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
        {
            if(!IsVehicleSeatOccupied(TRAMID, 1)) PutPlayerInVehicle(playerid, TRAMID, 1);
            if(!IsVehicleSeatOccupied(TRAMID, 2)) PutPlayerInVehicle(playerid, TRAMID, 2);
            if(!IsVehicleSeatOccupied(TRAMID, 3)) PutPlayerInVehicle(playerid, TRAMID, 3);
            if(!IsVehicleSeatOccupied(TRAMID, 4)) PutPlayerInVehicle(playerid, TRAMID, 4);
            if(!IsVehicleSeatOccupied(TRAMID, 5)) PutPlayerInVehicle(playerid, TRAMID, 5);
            SendClientMessage(playerid, 0x02b1afFF, "* Has subido al tranvнa. Para salir usa /salirtranvia.");
        }
        else return SendClientMessage(playerid, 0xFF6347FF, "* Demasiado lejos.");
        return 1;
    }
    if(strcmp(cmdtext, "/salirtranvia", true) == 0)
    {
        RemovePlayerFromVehicle(playerid);
        SetCameraBehindPlayer(playerid);
        return 1;
    }
    return 0;
}

stock IsVehicleSeatOccupied(vehicleid,seatid)
{
    if(!GetVehicleModel(vehicleid)) return 0;
    foreach(new i: Player)
    {
        if(IsPlayerInVehicle(i,vehicleid) && GetPlayerVehicleSeat(i) == seatid)
        {
            return 1;
        }
    }
    return 0;
}
Reply
#7

Quote:
Originally Posted by Tellken
Посмотреть сообщение
Serнa algo como esto

El valor de TRAMID es el id del coche en tu server, el que te de el /dl.

El cуdigo es tan sencillo gracias a la funciуn IsVehicleSeatOccupied, que no es nativa del samp:

pawn Код:
#define TRAMID    VALOR

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/tranvia", true) == 0)
    {
        new Float:x, Float:y, Float:z;
        GetVehiclePos(TRAMID, x, y, z);
        if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
        {
            if(!IsVehicleSeatOccupied(TRAMID, 1)) PutPlayerInVehicle(playerid, TRAMID, 1);
            if(!IsVehicleSeatOccupied(TRAMID, 2)) PutPlayerInVehicle(playerid, TRAMID, 2);
            if(!IsVehicleSeatOccupied(TRAMID, 3)) PutPlayerInVehicle(playerid, TRAMID, 3);
            if(!IsVehicleSeatOccupied(TRAMID, 4)) PutPlayerInVehicle(playerid, TRAMID, 4);
            if(!IsVehicleSeatOccupied(TRAMID, 5)) PutPlayerInVehicle(playerid, TRAMID, 5);
            SendClientMessage(playerid, 0x02b1afFF, "* Has subido al tranvнa. Para salir usa /salirtranvia.");
        }
        else return SendClientMessage(playerid, 0xFF6347FF, "* Demasiado lejos.");
        return 1;
    }
    if(strcmp(cmdtext, "/salirtranvia", true) == 0)
    {
        RemovePlayerFromVehicle(playerid);
        SetCameraBehindPlayer(playerid);
        return 1;
    }
    return 0;
}

stock IsVehicleSeatOccupied(vehicleid,seatid)
{
    if(!GetVehicleModel(vehicleid)) return 0;
    foreach(new i: Player)
    {
        if(IsPlayerInVehicle(i,vehicleid) && GetPlayerVehicleSeat(i) == seatid)
        {
            return 1;
        }
    }
    return 0;
}
Here is code for Trolley car San Fierro.

Код:
#define TRAMID 2

AddStaticVehicleEx(449,-2006.9436, 211.0592, 27.5391, 0.0, 0, 1, 1);

CMD:tranvia(playerid, params[])
{
new Float:x, Float:y, Float:z;
GetVehiclePos(TRAMID, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
{
PutPlayerInVehicle(playerid, TRAMID, 0);
}
else return SendClientMessage(playerid, 0xFF6347FF, "* Demasiado lejos.");
return 1;
}
CMD:subirtranvia(playerid, params[])
{
	new Float:x, Float:y, Float:z;
	GetVehiclePos(TRAMID, x, y, z);
	if(IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
	{
		if(!IsVehicleSeatOccupied(TRAMID, 1)) PutPlayerInVehicle(playerid, TRAMID, 1);
		if(!IsVehicleSeatOccupied(TRAMID, 2)) PutPlayerInVehicle(playerid, TRAMID, 2);
		if(!IsVehicleSeatOccupied(TRAMID, 3)) PutPlayerInVehicle(playerid, TRAMID, 3);
		if(!IsVehicleSeatOccupied(TRAMID, 4)) PutPlayerInVehicle(playerid, TRAMID, 4);
		if(!IsVehicleSeatOccupied(TRAMID, 5)) PutPlayerInVehicle(playerid, TRAMID, 5);
		SendClientMessage(playerid, 0x02b1afFF, "* Has subido al tranvнa. Para salir usa /salirtranvia.");
	}
	else return SendClientMessage(playerid, 0xFF6347FF, "* Demasiado lejos.");
	return 1;
}
CMD:salirtranvia(playerid, params[])
{
	RemovePlayerFromVehicle(playerid);
	SetCameraBehindPlayer(playerid);
	return 1;
}

stock IsVehicleSeatOccupied(vehicleid,seatid)
{
	if(!GetVehicleModel(vehicleid)) return 0;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerInVehicle(i,vehicleid) && GetPlayerVehicleSeat(i) == seatid)
		{
			return 1;
		}
	}
	return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)