SA-MP Forums Archive
Would This Work? - 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: Would This Work? (/showthread.php?tid=276576)



Would This Work? - Zonoya - 14.08.2011

Hey Guys its me again im trying to make a sub by attaching a sub piece to a predator boat it attaches fine but i make the script to enter the boat and it fails the server says ERROR: Unknown Command here is the script

Код:
		if(strcmp(cmdtext,"/ESub",true) == 0)
		{
		    if(IsPlayerInRangeOfPoint(playerid, -1304.10, 336.30, 5.07))
		    {
      			PutPlayerInVehicle(playerid, SubBoat, 0);
      		}
		    return 1;
		}
If U Can Help Me +rep


Re: Would This Work? - Grim_ - 14.08.2011

That code won't even compile! You dont' have the correct number of arguments for the IsPlayerInRangeOfPoint function: https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: Would This Work? - [HiC]TheKiller - 14.08.2011

No it wouldn't. You have no range for IsPlayerInRangeOfPoint

https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint


Re: Would This Work? - [MG]Dimi - 14.08.2011

Won't.
IsPlayerInRangeOfPoint(playerid, -1304.10, 336.30, 5.07);
You are missing float: range. Template is: IsPlayerInRangeOfPoint(playerid,float:range,float: x,float:y,float:z).
replace it with this one:
PHP код:
IsPlayerInRangeOfPoint(playerid,10.0, -1304.10336.305.07
If you have defined SubBoat it should work


Re: Would This Work? - Zonoya - 14.08.2011

oh thanks forgot that part


Re: Would This Work? - Darnell - 14.08.2011

Did you put it under OnPlayerCommandText ?
You used https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint wrong too.


Re: Would This Work? - Zonoya - 14.08.2011

i know its sorted now but now the object wont attach to the boat

Код:

	SubBase = CreateObject(9958, -1296.66, 344.63, 6.33,   0.00, 0.00, 0.00);
	SubBoat = CreateVehicle(430, -1296.5679, 334.5663, 0.0000, 183.0000, -1, -1, 100);

	AttachObjectToVehicle(SubBase, SubBoat, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0);
Can U Help Me With This (i know im a pain xD)


Re: Would This Work? - [MG]Dimi - 14.08.2011

SubBase = CreateObject(9958, -1296.66, 344.63, 6.33, 0.00, 0.00, 0.00,//missing float:draw distance);


Re: Would This Work? - Zonoya - 14.08.2011

still dont attach the object

thats what i need help with


Re: Would This Work? - [MG]Dimi - 14.08.2011

When did you define SubBoat and SubBase? Coz You should try:
PHP код:
new SubBase[MAX_PLAYERS],SubBoat[MAX_PLAYERS];
//replace all SubBoat to SubBoat[playerid] and SubBase to SubBase[playerid] 
if you are adding it when player enters the vehicle. If you are adding it OnGameModeInit() use
PHP код:
new SubBase[//number of boats],SubBase[//number of boats again]; 
and then while you are making them use
PHP код:
SubBoat[0] = 
SubBoat[1] = 
...
SubBase[0] = 
SubBase[1] = 
Then use
PHP код:
AttachObjectToVehicle(SubBase[0],SubBoat[0],...
AttachObjectToVehicle(SubBase[1],SubBoat[1],...
AttachObjectToVehicle(SubBase[2],SubBoat[2],...
...