[SOLVED] -
Vexus - 12.07.2013
[SOLVED]
Re: [NEED HELP] - Player Variables for Trucking Job -
Vexus - 12.07.2013
Does anyone have any idea? If you need more detail, please let me know.
I haven't been able to come up with any solution.
Re: [NEED HELP] - Player Variables for Trucking Job -
Rufio - 12.07.2013
Let me tell if I understood right. You would like to create a trucking job and would like people who wants to be a trucker to be put in the pre-specified truck automatically, right ? If it's right what do you want us to do ? Put them inside or specifying the truck's idea ? I might be a bit helpless as i am in phone right now.
Edit: Seems like i completely messed lol. I am helpless in making a private truck for yourself. Sorry.
Respuesta: [NEED HELP] - Player Variables for Trucking Job -
PHudson - 12.07.2013
Maybe something like this? It's just the basic structure, then you have to customize it:
pawn Код:
new UserTruck[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
UserTruck[playerid] = INVALID_VEHICLE_ID;
return 1;
}
pawn Код:
// When a player starts his job and is put inside the truck:
UserTruck[playerid] = GetPlayerVehicleID(playerid);
pawn Код:
// When a player attempts to return a truck:
if(UserTruck[playerid] == GetPlayerVehicleID(playerid))
{
// What should happen if the truck is his?
}
else
{
// What should happen if the truck's ID doesn't match the player's truck ID? Maybe an error message for the player?
}
I hope I helped you.
Re: [NEED HELP] - Player Variables for Trucking Job -
Vexus - 12.07.2013
Quote:
Originally Posted by Rufio
Let me tell if I understood right. You would like to create a trucking job and would like people who wants to be a trucker to be put in the pre-specified truck automatically, right ? If it's right what do you want us to do ? Put them inside or specifying the truck's idea ? I might be a bit helpless as i am in phone right now.
Edit: Seems like i completely messed lol. I am helpless in making a private truck for yourself. Sorry.
|
Any reply helps, no worries.
I mean I need to set a variable for that specific vehicle. I've already written the spawning and the PutPlayerInVehicle, etc... I just need a way for the player to basically... "temporarily own" the truck, so only they can use it. But when they /returntruck it will remove that variable.
Re: Respuesta: [NEED HELP] - Player Variables for Trucking Job -
Vexus - 12.07.2013
Quote:
Originally Posted by PHudson
Maybe something like this? It's just the basic structure, then you have to customize it:
pawn Код:
new UserTruck[MAX_PLAYERS];
public OnPlayerConnect(playerid) { UserTruck[playerid] = INVALID_VEHICLE_ID; return 1; }
pawn Код:
// When a player starts his job and is put inside the truck: UserTruck[playerid] = GetPlayerVehicleID(playerid);
pawn Код:
// When a player attempts to return a truck: if(UserTruck[playerid] == GetPlayerVehicleID(playerid)) { // What should happen if the truck is his? } else { // What should happen if the truck's ID doesn't match the player's truck ID? Maybe an error message for the player? }
I hope I helped you.
|
This is very close to what I'd need... I just need it to work in a way that every other player can't use the truck at all. I want only the spawner to be able to use it and return it.
EDIT: And since there will be around 10 truckers trucking at once, I need that to be possible, which is why I'm so stumped!
Respuesta: [NEED HELP] - Player Variables for Trucking Job -
PHudson - 12.07.2013
Ok, simply add this to my code above:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
//if(!IsATruck(vehicleid)) return 1; Perhaps you don't want all vehicles to be restricted?
if(!ispassenger && UserTruck[playerid] != vehicleid)
{
new Float:position[3];
GetPlayerPos(playerid,position[0],position[1],position[2]);
SetPlayerPos(playerid,position[0],position[1],position[2]+0.4);
}
return 1;
}
Re: Respuesta: [NEED HELP] - Player Variables for Trucking Job -
Vexus - 12.07.2013
Thank you very much! That seemed to do the trick!