[HELP]Adding FS to GM
#1

Hello everybody,i tryed to add Sandra's Truck missions Fs to my GM,all is positive but the text is not sending.
Like this :
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicle = GetPlayerVehicleID(playerid);
    if(newstate == 2)
    {
        if(TruckmissionPlaying[playerid] == 0)
        {
            new PTruck;
            for(new ID=1; ID<MAX_MISSIONS; ID++)
            {
                if(IsPlayerInVehicle(playerid, Truck[ID]))
                {
                    PTruck = ID;
                    break;
                }
            }
            if(PTruck > 0 && GetVehicleModel(vehicle) == 514)
            {
                TogglePlayerControllable(playerid, 0);
                new string[128];
                format(string, sizeof(string), "You can do #%d mission with this truck.", PTruck);
                SendClientMessage(playerid, COLOR_ORANGE, string);
                SendClientMessage(playerid, COLOR_ORANGE, "To start mission,type /startmission for exit,please type /exit.");
            }
        }
    }
    return 1;
}
If i'm enter Tanker(Model:514) it isn't send anything like "type /startmission" etc.
But i execute it with filterscript,it works.Why?How can i solve it ?Please help me.
Reply
#2

I'm pretty sure this is not the whole filterscript..Where's OnPlayerCommandText and the rest? Show us the whole FS. It's not hard though, just copy important things from OnFilterScriptInIt to OnGameModeInit, then any command that is in, put it below 'OnPlayerCommandText'.

But still, show us the whole FS.
Reply
#3

If you are entering the tanker (modelid 514) and you do not see the mission text, then troubleshoot your code backwards from that point onwards.

No text must mean PTruck = 0.

If PTruck = 0, then the player must not be in any of the Truck[] vehicles.

If you really think the player is in a Truck[] vehicle, then TruckmissionPlaying != 0 for that player.

To further debug your code, use the command print or printf to write variables to the server console so you can confirm what variables are set to. You can also use these commands to check which parts of your code are being executed, eg. ...

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate) {
    new vehicle = GetPlayerVehicleID(playerid);
    if(newstate == 2)
    {
        printf("player %d is a vehicle driver in OnPlayerStateChange", playerid);
        if(TruckmissionPlaying[playerid] == 0)
        {
            printf("player %d is not in a mission", playerid);
        }
    }
    return 1;
}
etc
Reply
#4

lulz watch sandra not get any credit for this xD moO!
Reply
#5

I can't understand
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)