Help with dialog and StateChange and Variables
#1

Ok so I think what i need is pretty simple, i'm learning quite a bit of pawn since i'v first started but I'm just starting to learn OnPlayerStateChange and etc.. I need it so when a player enters a certain amount of vehicles(certain IDs) a dialog will pop up heres what I have so far
pawn Code:
//news
new truck1;
new truck2;
new truck3;
new truck4;
new truck5;
new truck6;
new VehicleID[MAX_PLAYERS];
//-------------------------------
OnGameModeInit
        truck1 = CreateVehicle(515,616.83020020,1660.73547363,8.14590836,64.00000000,-1,-1,500);
    truck2 = CreateVehicle(515,613.18267822,1657.07287598,8.14590836,66.00000000,-1,-1,500);
    truck3 = CreateVehicle(514,608.20312500,1654.12878418,7.69186258,66.00000000,-1,-1,500);
    truck4 = CreateVehicle(514,602.98663330,1651.26123047,7.69186258,66.00000000,-1,-1,500);
    truck5 = CreateVehicle(403,599.76226807,1647.28845215,7.69218779,66.00000000,-1,-1,500);
    truck6 = CreateVehicle(403,594.54644775,1644.41662598,7.69218779,66.00000000,-1,-1,500);
Now I need to know how to make it so when a players enters those vehicles as driver a dialog pops up, need help ASAP, thanks
Reply
#2

pawn Code:
new truck[6];
new VehicleID[MAX_PLAYERS];//in this function this variable have no use
//-------------------------------
OnGameModeInit
    truck[0] = CreateVehicle(515,616.83020020,1660.73547363,8.14590836,64.00000000,-1,-1,500);
    truck[1] = CreateVehicle(515,613.18267822,1657.07287598,8.14590836,66.00000000,-1,-1,500);
    truck[2] = CreateVehicle(514,608.20312500,1654.12878418,7.69186258,66.00000000,-1,-1,500);
    truck[3] = CreateVehicle(514,602.98663330,1651.26123047,7.69186258,66.00000000,-1,-1,500);
    truck[4] = CreateVehicle(403,599.76226807,1647.28845215,7.69218779,66.00000000,-1,-1,500);
    truck[5] = CreateVehicle(403,594.54644775,1644.41662598,7.69218779,66.00000000,-1,-1,500);

//OnPlayerStateChange
new carid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && carid>=truck[0] && carid<=truck[5])
{
    //Put the dialog here
}
Reply
#3

Thanks!
Reply
#4

Code:
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(91) : error 017: undefined symbol "truck"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(91) : warning 215: expression has no effect
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(91) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(91) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(91) : fatal error 107: too many error messages on one line
why do I get these errors?
Reply
#5

you must put the "new truck[6];" out of publics...functions...

put on the top of your script
Reply
#6

pawn Code:
new truck1;
new truck2;
new truck3;
new truck4;
new truck5;
new truck[6];
new VehicleID[MAX_PLAYERS];
Reply
#7

Code:
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(27) : error 017: undefined symbol "truck6"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(93) : error 017: undefined symbol "DIALOG_TRUCKMISSION"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(109) : error 021: symbol already defined: "OnDialogResponse"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(113) : warning 203: symbol is never used: "VehicleID"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(22) : warning 204: symbol is assigned a value that is never used: "truck1"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(23) : warning 204: symbol is assigned a value that is never used: "truck2"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(24) : warning 204: symbol is assigned a value that is never used: "truck3"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(25) : warning 204: symbol is assigned a value that is never used: "truck4"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\trucker.pwn(26) : warning 204: symbol is assigned a value that is never used: "truck5
Sorry for so money questions, Its getting annoying!

I still get these.
Reply
#8

pawn Code:
new truck1;
new truck2;
new truck3;
new truck4;
new truck5;//you dont use those
new truck[6];//in this array you can use 6 times the same variable like

truck[0] =
truck[1] = //and goes on...

Use exactly that way ->
pawn Code:
new truck[6];//put on top of your script
new VehicleID[MAX_PLAYERS];//on top of your script too
//-------------------------------
// in OnGameModeInit
    truck[0] = CreateVehicle(515,616.83020020,1660.73547363,8.14590836,64.00000000,-1,-1,500);
    truck[1] = CreateVehicle(515,613.18267822,1657.07287598,8.14590836,66.00000000,-1,-1,500);
    truck[2] = CreateVehicle(514,608.20312500,1654.12878418,7.69186258,66.00000000,-1,-1,500);
    truck[3] = CreateVehicle(514,602.98663330,1651.26123047,7.69186258,66.00000000,-1,-1,500);
    truck[4] = CreateVehicle(403,599.76226807,1647.28845215,7.69218779,66.00000000,-1,-1,500);
    truck[5] = CreateVehicle(403,594.54644775,1644.41662598,7.69218779,66.00000000,-1,-1,500);

// in OnPlayerStateChange
new carid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && carid>=truck[0] && carid<=truck[5])
{
    //Put the dialog here
}
Reply
#9

Thanks, repped.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)