SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 06/10/2011, 02:59 AM   #1
Azzeto
Huge Clucker
 
Join Date: Jul 2011
Posts: 417
Reputation: 23
Default Help with dialog and StateChange and Variables

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
Azzeto is offline   Reply With Quote
Old 06/10/2011, 03:23 AM   #2
Pharrel
High-roller
 
Pharrel's Avatar
 
Join Date: Feb 2011
Location: Brazil
Posts: 1,530
Reputation: 135
Default Re: Help with dialog and StateChange and Variables

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
}
__________________

"Afirmo que ambos somos ateus. Apenas acredito num deus a menos que você.
Quando você entender porque é que rejeita todos os outros deuses possíveis,
entenderá porque é que eu rejeito o seu."
Stephen Henry Roberts
Pharrel is offline   Reply With Quote
Old 06/10/2011, 06:25 AM   #3
Azzeto
Huge Clucker
 
Join Date: Jul 2011
Posts: 417
Reputation: 23
Default Re: Help with dialog and StateChange and Variables

Thanks!
Azzeto is offline   Reply With Quote
Old 06/10/2011, 06:35 AM   #4
Azzeto
Huge Clucker
 
Join Date: Jul 2011
Posts: 417
Reputation: 23
Default Re: Help with dialog and StateChange and Variables

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?
Azzeto is offline   Reply With Quote
Old 06/10/2011, 06:54 AM   #5
Pharrel
High-roller
 
Pharrel's Avatar
 
Join Date: Feb 2011
Location: Brazil
Posts: 1,530
Reputation: 135
Default Re: Help with dialog and StateChange and Variables

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

put on the top of your script
__________________

"Afirmo que ambos somos ateus. Apenas acredito num deus a menos que você.
Quando você entender porque é que rejeita todos os outros deuses possíveis,
entenderá porque é que eu rejeito o seu."
Stephen Henry Roberts
Pharrel is offline   Reply With Quote
Old 06/10/2011, 07:02 AM   #6
Azzeto
Huge Clucker
 
Join Date: Jul 2011
Posts: 417
Reputation: 23
Default Re: Help with dialog and StateChange and Variables

pawn Code:
new truck1;
new truck2;
new truck3;
new truck4;
new truck5;
new truck[6];
new VehicleID[MAX_PLAYERS];
Azzeto is offline   Reply With Quote
Old 06/10/2011, 07:07 AM   #7
Azzeto
Huge Clucker
 
Join Date: Jul 2011
Posts: 417
Reputation: 23
Default Re: Help with dialog and StateChange and Variables

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.
Azzeto is offline   Reply With Quote
Old 06/10/2011, 07:54 AM   #8
Pharrel
High-roller
 
Pharrel's Avatar
 
Join Date: Feb 2011
Location: Brazil
Posts: 1,530
Reputation: 135
Default Re: Help with dialog and StateChange and Variables

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
}
__________________

"Afirmo que ambos somos ateus. Apenas acredito num deus a menos que você.
Quando você entender porque é que rejeita todos os outros deuses possíveis,
entenderá porque é que eu rejeito o seu."
Stephen Henry Roberts
Pharrel is offline   Reply With Quote
Old 06/10/2011, 10:29 AM   #9
Azzeto
Huge Clucker
 
Join Date: Jul 2011
Posts: 417
Reputation: 23
Default Re: Help with dialog and StateChange and Variables

Thanks, repped.
Azzeto is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Player Variables vs Normal Variables. Carlton Tutorials 24 09/09/2016 07:19 PM
[Ajuda]StateChange [R] ousenber [K] Português/Portuguese 29 27/08/2011 07:16 PM
Global variables or Local variables armyoftwo Help Archive 3 02/10/2010 04:45 PM
[help]Variables Naxix Help Archive 3 17/04/2010 08:47 AM


All times are GMT. The time now is 11:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.