PDA

View Full Version : Help with dialog and StateChange and Variables


Azzeto
06/10/2011, 02:59 AM
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
//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.145 90836,64.00000000,-1,-1,500);
truck2 = CreateVehicle(515,613.18267822,1657.07287598,8.145 90836,66.00000000,-1,-1,500);
truck3 = CreateVehicle(514,608.20312500,1654.12878418,7.691 86258,66.00000000,-1,-1,500);
truck4 = CreateVehicle(514,602.98663330,1651.26123047,7.691 86258,66.00000000,-1,-1,500);
truck5 = CreateVehicle(403,599.76226807,1647.28845215,7.692 18779,66.00000000,-1,-1,500);
truck6 = CreateVehicle(403,594.54644775,1644.41662598,7.692 18779,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

Pharrel
06/10/2011, 03:23 AM
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.145 90836,64.00000000,-1,-1,500);
truck[1] = CreateVehicle(515,613.18267822,1657.07287598,8.145 90836,66.00000000,-1,-1,500);
truck[2] = CreateVehicle(514,608.20312500,1654.12878418,7.691 86258,66.00000000,-1,-1,500);
truck[3] = CreateVehicle(514,602.98663330,1651.26123047,7.691 86258,66.00000000,-1,-1,500);
truck[4] = CreateVehicle(403,599.76226807,1647.28845215,7.692 18779,66.00000000,-1,-1,500);
truck[5] = CreateVehicle(403,594.54644775,1644.41662598,7.692 18779,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
}

Azzeto
06/10/2011, 06:25 AM
Thanks!

Azzeto
06/10/2011, 06:35 AM
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(91) : error 017: undefined symbol "truck"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(91) : warning 215: expression has no effect
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(91) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(91) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(91) : fatal error 107: too many error messages on one line why do I get these errors?

Pharrel
06/10/2011, 06:54 AM
you must put the "new truck[6];" out of publics...functions...

put on the top of your script

Azzeto
06/10/2011, 07:02 AM
new truck1;
new truck2;
new truck3;
new truck4;
new truck5;
new truck[6];
new VehicleID[MAX_PLAYERS];

Azzeto
06/10/2011, 07:07 AM
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(27) : error 017: undefined symbol "truck6"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(93) : error 017: undefined symbol "DIALOG_TRUCKMISSION"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(109) : error 021: symbol already defined: "OnDialogResponse"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(113) : warning 203: symbol is never used: "VehicleID"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(22) : warning 204: symbol is assigned a value that is never used: "truck1"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(23) : warning 204: symbol is assigned a value that is never used: "truck2"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(24) : warning 204: symbol is assigned a value that is never used: "truck3"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.pwn(25) : warning 204: symbol is assigned a value that is never used: "truck4"
C:\Documents and Settings\Customer\Desktop\GameMode\filterscripts\t rucker.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.

Pharrel
06/10/2011, 07:54 AM
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 ->
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.145 90836,64.00000000,-1,-1,500);
truck[1] = CreateVehicle(515,613.18267822,1657.07287598,8.145 90836,66.00000000,-1,-1,500);
truck[2] = CreateVehicle(514,608.20312500,1654.12878418,7.691 86258,66.00000000,-1,-1,500);
truck[3] = CreateVehicle(514,602.98663330,1651.26123047,7.691 86258,66.00000000,-1,-1,500);
truck[4] = CreateVehicle(403,599.76226807,1647.28845215,7.692 18779,66.00000000,-1,-1,500);
truck[5] = CreateVehicle(403,594.54644775,1644.41662598,7.692 18779,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
}

Azzeto
06/10/2011, 10:29 AM
Thanks, repped.