Code won't work tough it looks allright! -
Zh3r0 - 02.02.2011
What did i do wrong, this is pathetic ... It does tell me when i don't have a trailer attached, but when i have it code inside the trailer check won't run...
pawn Код:
public OnPlayerEnterCheckpoint( playerid )
{
if ( GetVehicleTrailer(GetPlayerVehicleID(playerid)) )
{
new RandomLoad = sizeof( g_LoadData );
InfoEx( playerid, "Arrived at the loading point...~n~~n~Loading: "_G2"%s~n~~w~Loading Time: %d~n~~w~Destination: "_G3"%s", g_LoadData[ RandomLoad ][ g_LoadName ], g_LoadData[ RandomLoad ][ g_LoadTime ], TruckData[ pData[ playerid ][ RandomPoint ] ][ g_ArriveName ]);
SetTimerEx("Load", g_LoadData[ RandomLoad ][ g_LoadTime ] * 1000, false, "d", playerid,TogglePlayerControllable( playerid, false ) );
}
else Info( playerid, "You need a trailer for this mission! You can either type ~r~~h~/SHOP~w~ and buy one with "_G1"$800" );
return 1;
}
I did use IsTrailerAttachedToVehicle, same thing.
Re: Code won't work tough it looks allright! -
Krx17 - 02.02.2011
pawn Код:
public OnPlayerEnterCheckpoint( playerid )
{
if ( IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) )
{
new RandomLoad = sizeof( g_LoadData );
InfoEx( playerid, "Arrived at the loading point...~n~~n~Loading: "_G2"%s~n~~w~Loading Time: %d~n~~w~Destination: "_G3"%s", g_LoadData[ RandomLoad ][ g_LoadName ], g_LoadData[ RandomLoad ][ g_LoadTime ], TruckData[ pData[ playerid ][ RandomPoint ] ][ g_ArriveName ]);
SetTimerEx("Load", g_LoadData[ RandomLoad ][ g_LoadTime ] * 1000, false, "d", playerid,TogglePlayerControllable( playerid, false ) );
}
else Info( playerid, "You need a trailer for this mission! You can either type ~r~~h~/SHOP~w~ and buy one with "_G1"$800" );
return 1;
}
Re: Code won't work tough it looks allright! -
Vince - 02.02.2011
Not sure what you're trying to do in your SetTimerEx.
I guess it should be:
pawn Код:
SetTimerEx("Load", g_LoadData[ RandomLoad ][ g_LoadTime ] * 1000, false, "d", playerid);
TogglePlayerControllable(playerid, false);
Re: Code won't work tough it looks allright! -
Mauzen - 02.02.2011
Agree with Vince, this can cause problems.
But there also have to be a problem with InfoEx if not even the text is shown (script crashes in there and the whole function ends)
How does this work? A define i guess?
pawn Код:
Destination: "_G3"%s" //"..."_???"..."
Show your InfoEx code if you want to, could be a problem with your custom format for example.
Re: Code won't work tough it looks allright! -
Zh3r0 - 03.02.2011
Quote:
Originally Posted by Mauzen
Agree with Vince, this can cause problems.
But there also have to be a problem with InfoEx if not even the text is shown (script crashes in there and the whole function ends)
How does this work? A define i guess?
pawn Код:
Destination: "_G3"%s" //"..."_???"..."
Show your InfoEx code if you want to, could be a problem with your custom format for example.
|
Gotta try without what you guys told me.
About the _G3 yes it's a define for ~g~~h~~h~~h~
Also, i wanted to see how SetTimerEx actually works and added the TogglePlayerControllable.
I will do a simple debug with SendClientMessage.
Thanks guys.
@Krx17 - I said that i already tried with IsTrailerAttachedToVehicle.
Re: Code won't work tough it looks allright! -
Macluawn - 03.02.2011
ehh.. I guess you wasn't joking about making a trucker gamemode.
Re: Code won't work tough it looks allright! -
Zh3r0 - 03.02.2011
Quote:
Originally Posted by Macluawn
ehh.. I guess you wasn't joking about making a trucker gamemode.
|
Wow, is this you?

I just want to have fun..nothing much, i really love scripting and learning day by day, so this can be the reason ...
I debugged a bit, it does not go over the timer..
Also here is the code i have for InfoEx.
EDIT: Solved, i forgot to add the random( sizeof( g_...)