[Help] One truck - 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: [Help] One truck (
/showthread.php?tid=72171)
[Help] One truck -
Amoken - 06.04.2009
Hello everybody, I got a prob with truckers job. I made it so the trucker must be in a truck(Linerunner) in order to pick up the fuel but its not required carring petrol trailer behind him, and its a lot non-rp. Do u know how to make it so the trucker have to pick up petrol trailer while /buyfuel and /sellfuel?
Re: [Help] One truck -
Torekk - 07.04.2009
You just need to make your commands only work if the trailer is attached, like this:
pawn Код:
if(GetVehicleTrailer(GetPlayerVehicleID(playerid) == <id of your trailer>)
{
// if trailer is attached
} else {
// if trailer is NOT attached
}
If you need more help, just post your current command and I'll try to make it work.
Re: [Help] One truck -
Amoken - 07.04.2009
thxxxxxxxxxxx man u awsomeeee do I need to make any new variable in order to make this thing work or its on the pwn its self?
Re: [Help] One truck -
Amoken - 07.04.2009
when u say trailer id u mean on the server or on the samp client?
Re: [Help] One truck -
Amoken - 07.04.2009
thats the code It doesnt work
Код:
if(strcmp(cmd, "/buyfuel", true) == 0)
{
if(PlayerInfo[playerid][pJob] != 16)
{
SendClientMessage(playerid, COLOR_GREY, "You are not a trucker.");
return 1;
}
else if(PlayerToPoint(25.0, playerid, 999.6520,-897.9469,42.2462))
{
new oil;
oil = strval(tmp);
if (PlayerInfo[playerid][pOil] >= 100)
{
SendClientMessage(playerid, COLOR_GREY, "Your truck is filled up.");
return 1;
}
else
{
if(GetPlayerMoney(playerid) < 499)
{
SendClientMessage(playerid, COLOR_GREY, "You dont have enought money ($500).");
return 1;
}
}
new tmpcar = GetPlayerVehicleID(playerid);
if(!IsATruck(tmpcar))
{
SendClientMessage(playerid, COLOR_GREY, "You are not in a Truck.");
return 1;
}
else
{
if(GetVehicleTrailer(GetPlayerVehicleID(playerid) == 584))
{
SafeGivePlayerMoney(playerid, - 500);
PlayerInfo[playerid][pOil] = 100;
format(string, sizeof(string), "You have filled your truck with fuel!", oil, oil * 150);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SaveOilSystem();
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not carring a trailer.");
return 1;
}
}
}
return 1;
}
Re: [Help] One truck -
Amoken - 07.04.2009
any advice guys?
Re: [Help] One truck -
Amoken - 07.04.2009
wtf cant u give an answer?!?! anyone of u
Re: [Help] One truck -
Torekk - 07.04.2009
What the fuck maybe some patience? This isn't a chatroom... I can't help you, because I don't understand your code. Also I'm not that "good" in pawno coding, so yeah.
Re: [Help] One truck -
DiDok - 07.04.2009
Yeah this code is messed up X/ (Godfather, eh?)
Change this:
pawn Код:
if(GetVehicleTrailer(GetPlayerVehicleID(playerid) == 584))
to:
pawn Код:
if(GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid))) == 584)
It should work, ain't checked it yet, but I'm working on that in my gamemode, so I'll have working solution soon.