Code won't work tough it looks allright!
#1

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.
Reply
#2

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;
}
Reply
#3

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);
Reply
#4

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.
Reply
#5

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.
Reply
#6

ehh.. I guess you wasn't joking about making a trucker gamemode.
Reply
#7

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_...)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)