truck script -
thuron - 11.03.2009
hello, im having a small problem with my truck job script.
i wanted to add an
Код:
if(PlayerToPoint(1.5,playerid,-1834.4691, 129.1151, 15.1171))
but like this is wont work:
Код:
if(!strcmp("/buyprod", cmdtext, true,9))
{
if(PlayerToPoint(1.5,playerid,-1834.4691, 129.1151, 15.1171))
{
SendClientMessage(playerid, COLOR_RED, "You have to be at the truck station");
}
{
if(!IsPlayerInVehicle(playerid, truck1))
{
SendClientMessage(playerid, COLOR_RED, "You have to be in a truck!");
}
else if(GetPlayerMoney(playerid) >= 500)
{
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, COLOR_CYELLOW, "You have bought products for $500.");
AttachTrailerToVehicle(trailer1,truck1);
}
else
{
SendClientMessage(playerid, COLOR_CYELLOW, "You dont have $500!");
}
return 1;
}
return 0;
}
does anyone have an idea how to get this working?
Re: truck script -
Dujma - 11.03.2009
if(
!PlayerToPoint(1.5,playerid,-1834.4691, 129.1151, 15.1171))
You used if the playes IS on that point that he will get that message. And use return 1; because the way you did it even if he is not on that point he will be able to ge prods just with the message.
if(
!PlayerToPoint(1.5,playerid,-1834.4691, 129.1151, 15.1171))
{
SendClientMessage(playerid, COLOR_RED, "You have to be at the truck station");
return 1;
}
Grr I'm eating right now but your code is all mest up.
Re: truck script -
MenaceX^ - 11.03.2009
Код:
if(!strcmp(cmd,"/buyprod",true))
{
if(!PlayerToPoint(1.5,playerid,-1834.4691, 129.1151, 15.1171)) return SendClientMessage(playerid, COLOR_RED, "You have to be at the truck station");
if(!IsPlayerInVehicle(playerid, truck1)) return SendClientMessage(playerid, COLOR_RED, "You have to be in a truck!");
if(GetPlayerMoney(playerid) >= 500)
{
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, COLOR_CYELLOW, "You have bought products for $500.");
AttachTrailerToVehicle(trailer1,truck1);
}
else
{
SendClientMessage(playerid, COLOR_CYELLOW, "You dont have $500!");
}
return 1;
}
return 0;
}
Correct code.
Re: truck script -
Dujma - 11.03.2009
pawn Код:
if(strcmp(cmd, "/buyprod", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(1.5,playerid,-1834.4691, 129.1151, 15.1171))
{
SendClientMessage(playerid, COLOR_RED, "You have to be at the truck station");
return 1;
}
if(!IsPlayerInVehicle(playerid, truck1))
{
SendClientMessage(playerid, COLOR_RED, "You have to be in a truck!");
return 1;
}
if(GetPlayerMoney(playerid) >= 500)
{
GivePlayerMoney(playerid, -500);
SendClientMessage(playerid, COLOR_CYELLOW, "You have bought products for $500.");
AttachTrailerToVehicle(trailer1,truck1);
}
else
{
SendClientMessage(playerid, COLOR_CYELLOW, "You dont have $500!");
return 1;
}
}
return 1;
}
Re: truck script -
MenaceX^ - 11.03.2009
Why should he use your code?.. Look how many less things you got there..
It's could be really short in this way.
pawn Код:
if(!strcmp(cmd,"/buyprod",true))
{
if(!PlayerToPoint(1.5,playerid,-1834.4691, 129.1151, 15.1171))
return SendClientMessage(playerid, COLOR_RED, "You have to be at the truck station");
if(!IsPlayerInVehicle(playerid, truck1))
return SendClientMessage(playerid, COLOR_RED, "You have to be in a truck!");
if(GetPlayerMoney(playerid)<=500)
return SendClientMessage(playerid,CYELLOW,"You don't have $500");
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid, COLOR_CYELLOW, "You have bought products for $500.");
return AttachTrailerToVehicle(trailer1,truck1);
}
Re: truck script -
thuron - 11.03.2009
my fault, sorry, just gotta change the 500 to 499
Re: truck script -
thuron - 11.03.2009
hmm, now i've got an other problem. on every truck, the messages work now when you hop in. but when you type /buyprod in truck0, it will work, if you type it in truck 1-4, it wont work. here is the piece of script:
Код:
if(!strcmp("/buyprod", cmdtext, true,9))
for(new i; i<sizeof(truck); i++)
{
if(GetPlayerMoney(playerid)<=499)
return SendClientMessage(playerid,COLOR_RED,"You don't have $500");
if(!PlayerToPoint(10.0,playerid,-1834.4691, 129.1151, 15.1171))
return SendClientMessage(playerid, COLOR_RED, "You have to be at the truck station");
if(!IsPlayerInVehicle(playerid, truck[i]))
return SendClientMessage(playerid, COLOR_RED, "You have to be in a truck!");
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid, COLOR_GREEN, "You have bought products for $500.");
return AttachTrailerToVehicle(trailer[i],truck[i]);
}
return 0;
}
i've got everything good defined, so the problem has to be in here..
Re: truck script -
thuron - 13.03.2009
hmm, i just added that when you do /buyprod, that a checkpoint will come up, where you can sell it, but the checkpoint shows up, and moves away directly after spawning. the problem should be in here:
Код:
CP1_truckerjob = CreateCheckpoint(-1478.9224,-208.6589,13.8755, 3.0, 5, "CP1truckerjob",true);
when i // this lines, it works well, but i need them for the OnPlayerEnterCheckpoint.
does anyone know how to fix this?
Re: truck script -
thuron - 16.03.2009
can anyone PLEASE help me please! i really need to get this fixed for my new server.
Re: truck script -
[RP]Rav - 16.03.2009
Well, check your script for any instances of
DisablePlayerCheckpoint()