Wysłany: 2018-04-29, 02:41
JestemSuperLIKE
Początkujący grafik
Wiek: 27 Na forum: 3694 dni Posty: 133
Piwa : 6
Witam. Niedawno wr?ci?em do PAWN'a. O PAWN'ie zapomnia?em i mam problemy ze skryptowaniem. Nie wiem jak mog? da? misje dla ID_naczepa, i po pod??czeniu naczepy ma wyskoczy? dialog. Wyskakuje dialog po pod??czeniu naczepy ale jest spam. Korzystam z tego tutoriala: http://gtao.pl.com/showthread.php?t=340517 . Thx za pomoc.
Pomiesza?o mi si? w kodzie
Pawn
new iMissionText [ 512 ][ MAX_PLAYERS ], Cash_Money [ MAX_PLAYERS ], MissionStatus [ MAX_PLAYERS ];
new ID_trailer [ 3 ];
enum MissionsLocationEnum
{
ID_trailer ,
MissionPoint [ 128 ],
Float : UnLoad_X ,
Float : UnLoad_Y ,
Float : UnLoad_Z ,
Cash
}
new MissionsLocation [][ MissionsLocationEnum ] =
{
{ 0 , "Shop SF" , - 2177.2544 , 107.1364 , 35.3203 , 24999 + 1 }
};
public OnPlayerEnterCheckpoint ( playerid )
{
CheckpointEntered ( playerid );
return 1 ;
}
public OnTrailerUpdate ( playerid , vehicleid )
{
new vID = GetPlayerVehicleID ( playerid );
if( GetVehicleTrailer ( vID ) == ID_trailer [ 0 ]) //trailer 1 (ls)
{
ShowPlayerDialog ( playerid , /*MISSION_1*/ 997 , DIALOG_STYLE_MSGBOX , "Mission" , "Point: Shop LS\nPrize: 25000$" , "Yes" , "No" );
}
else if( GetVehicleTrailer ( vID ) == ID_trailer [ 1 ]) //trailer 2 lv
{
ShowPlayerDialog ( playerid , /*MISSION_2*/ 998 , DIALOG_STYLE_MSGBOX , "Mission" , "Point: Shop LV\nPrize: 25000$" , "Yes" , "No" );
}
else if( GetVehicleTrailer ( vID ) == ID_trailer [ 2 ]) //trailer 3 sf
{
ShowPlayerDialog ( playerid , /*MISSION_3*/ 999 , DIALOG_STYLE_MSGBOX , "Mission" , "Point: Shop SF\nPrize: 25000$" , "Yes" , "No" );
}
return 0 ;
}
public OnDialogResponse ( playerid , dialogid , response , listitem , inputtext [])
{
if( dialogid == 997 )
{
if( response )
{
SetPlayerCheckpoint ( playerid , - 2177.2544 , 107.1364 , 35.3203 , 7 );
}
else
{
SendClientMessage ( playerid , - 1 , "Canceled." );
}
}
if( dialogid == 998 )
{
if( response )
{
SetPlayerCheckpoint ( playerid , - 2177.2544 , 107.1364 , 35.3203 , 7 );
}
else
{
SendClientMessage ( playerid , - 1 , "Canceled." );
}
}
if( dialogid == 999 )
{
if( response )
{
SetPlayerCheckpoint ( playerid , - 2177.2544 , 107.1364 , 35.3203 , 7 );
}
else
{
SendClientMessage ( playerid , - 1 , "Canceled." );
}
}
return 1 ;
}
stock CheckpointEntered ( playerid )
{
new gString [ 128 ];
new vID = GetPlayerVehicleID ( playerid );
if(! IsTrailerAttachedToVehicle ( vID )) return SendClientMessage ( playerid , - 1 , "You need a trailer to unload!" );
if( MissionStatus [ playerid ] == 1 )
{
DisablePlayerCheckpoint ( playerid );
GivePlayerMoney ( playerid , Cash_Money [ playerid ]);
SendClientMessage ( playerid , - 1 , "Well done! You completed the mission!" );
format ( gString , 512 , "%s has completed mission: %s" , pName ( playerid ), iMissionText [ playerid ]);
SendClientMessageToAll (- 1 , gString );
SetPlayerScore ( playerid , GetPlayerScore ( playerid )+ 2 );
MissionStatus [ playerid ] = 0 ;
}
return 1 ;
}
Wysłany: 2018-04-29, 14:23
Combacior
Wiek: 29 Na forum: 5795 dni Posty: 1516
Piwa : 2161
Dlaczego pokazujesz dialog w callbacku OnTrailerUpdate? Na wiki przeczytasz, ?e:
Cytat: This callback is called very frequently per second per trailer
Musia?by? doda? jaki? warunek sprawdzaj?cy, czy graczowi pokaza? si? ju? dialog albo wykonuje ju? t? misj?. Ewentualnie poszuka? jaki? include OnTrailerAttached, wszystko zale?y od tego, kiedy dialog ma wyskoczy?, bo w tym tutorialu jest na komend?.
Tutaj przyk?adowy OnTrailerAttached, nie testowa?em tego, nie mojego autorstwa -> https://pastebin.com/7hmEiSQx
Wysłany: 2018-04-29, 21:07
JestemSuperLIKE
Początkujący grafik
Wiek: 27 Na forum: 3694 dni Posty: 133
Piwa : 6
Zapomnia?em jak si? dodaje warunek, a co do include to nie wiem jak go u?y?.
Mam problem z tym spamem dialogu.. Nie wiem jak mog? go rozwi?za? .
Pawn
#include <a_samp>
main (){}
new ID_trailer [ 3 ], MissionStatus [ MAX_PLAYERS ];
public OnGameModeInit ()
{
AddPlayerClass ( 72 , - 2105.3228 , - 124.2982 , 37.2531 , 0.0 , 0 , 0 , 0 , 0 , 0 , 0 );
CreateVehicle ( 403 , - 2108.1025 , - 103.3226 , 35.9260 , 0.0 , 1 , 1 , - 1 );
ID_trailer [ 0 ] = CreateVehicle ( 591 , - 2108.6060 ,- 124.2944 , 35.9257 , 359.7211 , 1 , 1 , - 1 );
ID_trailer [ 1 ] = CreateVehicle ( 591 , - 2103.5796 ,- 122.3023 , 35.9267 , 359.9224 , 1 , 1 , - 1 );
ID_trailer [ 2 ] = CreateVehicle ( 591 , - 2099.1572 ,- 124.2184 , 35.9266 , 359.7892 , 1 , 1 , - 1 );
return 1 ;
}
public OnTrailerUpdate ( playerid , vehicleid )
{
new vID = GetPlayerVehicleID ( playerid );
if( GetVehicleTrailer ( vID ) == ID_trailer [ 0 ]) //trailer 1 (ls)
{
ShowPlayerDialog ( playerid , 997 , DIALOG_STYLE_MSGBOX , "Mission" , "Point: Shop LS\nPrize: 25000$" , "Yes" , "No" );
}
else if( GetVehicleTrailer ( vID ) == ID_trailer [ 1 ]) //trailer 2 lv
{
ShowPlayerDialog ( playerid , 998 , DIALOG_STYLE_MSGBOX , "Mission" , "Point: Shop LV\nPrize: 25000$" , "Yes" , "No" );
}
else if( GetVehicleTrailer ( vID ) == ID_trailer [ 2 ]) //trailer 3 sf
{
ShowPlayerDialog ( playerid , 999 , DIALOG_STYLE_MSGBOX , "Mission" , "Point: Shop SF\nPrize: 25000$" , "Yes" , "No" );
}
return 0 ;
}
public OnDialogResponse ( playerid , dialogid , response , listitem , inputtext [])
{
if( dialogid == 997 )
{
if( response )
{
SetPlayerCheckpoint ( playerid , - 2177.2544 , 107.1364 , 35.3203 , 7 );
}
else
{
SendClientMessage ( playerid , - 1 , "Canceled." );
}
}
if( dialogid == 998 )
{
if( response )
{
SetPlayerCheckpoint ( playerid , - 2177.2544 , 107.1364 , 35.3203 , 7 );
}
else
{
SendClientMessage ( playerid , - 1 , "Canceled." );
}
}
if( dialogid == 999 )
{
if( response )
{
SetPlayerCheckpoint ( playerid , - 2177.2544 , 107.1364 , 35.3203 , 7 );
}
else
{
SendClientMessage ( playerid , - 1 , "Canceled." );
}
}
return 1 ;
}
stock CheckpointEntered ( playerid )
{
new vID = GetPlayerVehicleID ( playerid );
if(! IsTrailerAttachedToVehicle ( vID )) return SendClientMessage ( playerid , - 1 , "You need a trailer to unload!" );
if( MissionStatus [ playerid ] == 1 )
{
DisablePlayerCheckpoint ( playerid );
GivePlayerMoney ( playerid , 24999 + 1 );
SetVehicleToRespawn ( GetVehicleTrailer ( GetPlayerVehicleID ( playerid )));
MissionStatus [ playerid ] = 0 ;
}
return 1 ;
}
public OnPlayerEnterCheckpoint ( playerid )
{
CheckpointEntered ( playerid );
return 1 ;
}
stock pName ( PN )
{
new PX [ MAX_PLAYER_NAME ];
GetPlayerName ( PN , PX , sizeof ( PX ));
return PX ;
}
Tagi: system :: missions
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: