Simple job bug/problem -
tbedy - 14.02.2018
Well, guys.. I (tried) make simple job , but I have problem with 1st CP..
When I come to 1st CP , it nothing happens, like I'm not there...
Код:
BusLinija[ MAX_PLAYERS ],
Код:
case 10: {
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 431 && GetPlayerState( playerid ) == 2 ) {
if( BusLinija[ playerid ] < 11 ) {
Muma_DisablePlayerCheckpoint( playerid );
BusLinija[ playerid ]++;
CheckpointStatus[ playerid ] = 14;
}
if( BusLinija[ playerid ] == 2 ) Muma_SetPlayerCheckpoint( playerid, 963.2554, -1330.4203, 13.4962, 5.0 );
else if( BusLinija[ playerid ] == 3 ) Muma_SetPlayerCheckpoint( playerid, 1222.1409, -1284.2852, 13.5143, 5.0 );
else if( BusLinija[ playerid ] == 4 ) Muma_SetPlayerCheckpoint( playerid, 1426.8865, -1244.3213, 13.5173, 5.0 );
else if( BusLinija[ playerid ] == 5 ) Muma_SetPlayerCheckpoint( playerid, 1346.6564, -926.8917, 35.0315, 5.0 );
else if( BusLinija[ playerid ] == 6 ) Muma_SetPlayerCheckpoint( playerid, 1082.9972, -945.1513, 42.7620, 5.0 );
else if( BusLinija[ playerid ] == 7 ) Muma_SetPlayerCheckpoint( playerid, 394.6435, -1344.8381, 14.7427, 5.0 );
else if( BusLinija[ playerid ] == 8 ) Muma_SetPlayerCheckpoint( playerid, 346.2153, -1648.3312, 33.1769, 5.0 );
else if( BusLinija[ playerid ] == 9 ) Muma_SetPlayerCheckpoint( playerid, 1119.5483, -1708.8313, 13.5159, 5.0 );
else if( BusLinija[ playerid ] == 10 ) Muma_SetPlayerCheckpoint( playerid, 921.5195, -1713.4103, 13.5967, 5.0 );
else if( BusLinija[ playerid ] == 11 ) {
SetVehicleToRespawn( GetPlayerVehicleID( playerid ) );
Muma_DisablePlayerCheckpoint( playerid );
TogglePlayerControllable( playerid, true );
BusLinija[ playerid ] = 0;
CheckpointStatus[ playerid ] = 0;
Muma_KillTimer( BusVozac[ playerid ] );
new bonus = random( 500 );
format( globalstring, sizeof( globalstring ), ""col_job"Uspjesno ste zavrsili bus liniju!\n\n"col_white"Plata: "col_job"3000$\n"col_white"Bonus: "col_job"%d$", bonus );
SPD( playerid, 0, DSMSG, D_NASLOV, globalstring, "Ok", "" );
PlayerInfo[ playerid ][ xPlatniRacun ] += (3000+bonus);
SavePlayer( playerid );
StaroVreme[ playerid ] = 0;
NovoVreme[ playerid ] = 0;
BussinesJobMoney( POSAO_BUSVOZAC, ((2000+bonus)/10) );
return 1;
}
TogglePlayerControllable( playerid, false );
BusVozac[ playerid ] = SetTimerEx( "UtovarBus", 5000, false, "d", playerid );
GameTextForPlayer( playerid, "~y~Stanica", 5000, 3 );
}
}
case 11: {
Muma_DisablePlayerCheckpoint( playerid );
SCM( playerid, ZUTA, "Stigli ste na lokaciju.");
CheckpointStatus[ playerid ] = 0;
}
Код:
else if( PlayerInfo[ playerid ][ xPosao ] == POSAO_BUSVOZAC ) {
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 431 ) return GRESKA( playerid, "Niste u autobusu!");
if( BusLinija[ playerid ] != 0 ) return GRESKA( playerid, "Vec imas aktiviranu liniju, kucaj /prekiniposao!" );
Muma_SetPlayerCheckpoint( playerid, 920.9799, -1688.3843, 13.5080, 5.0 );
CheckpointStatus[ playerid ] = 14;
SendJobMessage( playerid, "Krenuli ste sa prevozom putnika, stanica je oznacena crveno na mapi!" );
BusLinija[ playerid ] = 1;
StaroVreme[ playerid ] = gettime();
NovoVreme[ playerid ] = 245;
return 1;
}
Re: Simple job bug/problem -
enzulikeS - 14.02.2018
Use SetPlayerRaceCheckpoint
https://sampwiki.blast.hk/wiki/SetPlayerRaceCheckpoint
Re: Simple job bug/problem -
RogueDrifter - 14.02.2018
Quote:
Originally Posted by enzulikeS
|
How the heck does that even relate?!
@OP: Are you even using OnPlayerEnterCheckpoint for that?
Re: Simple job bug/problem -
tbedy - 14.02.2018
public OnPlayerEnterCheckpoint( playerid ) {
Код:
case 10: {
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 431 && GetPlayerState( playerid ) == 2 ) {
if( BusLinija[ playerid ] < 11 ) {
Muma_DisablePlayerCheckpoint( playerid );
BusLinija[ playerid ]++;
CheckpointStatus[ playerid ] = 14;
}
if( BusLinija[ playerid ] == 2 ) Muma_SetPlayerCheckpoint( playerid, 963.2554, -1330.4203, 13.4962, 5.0 );
else if( BusLinija[ playerid ] == 3 ) Muma_SetPlayerCheckpoint( playerid, 1222.1409, -1284.2852, 13.5143, 5.0 );
else if( BusLinija[ playerid ] == 4 ) Muma_SetPlayerCheckpoint( playerid, 1426.8865, -1244.3213, 13.5173, 5.0 );
else if( BusLinija[ playerid ] == 5 ) Muma_SetPlayerCheckpoint( playerid, 1346.6564, -926.8917, 35.0315, 5.0 );
else if( BusLinija[ playerid ] == 6 ) Muma_SetPlayerCheckpoint( playerid, 1082.9972, -945.1513, 42.7620, 5.0 );
else if( BusLinija[ playerid ] == 7 ) Muma_SetPlayerCheckpoint( playerid, 394.6435, -1344.8381, 14.7427, 5.0 );
else if( BusLinija[ playerid ] == 8 ) Muma_SetPlayerCheckpoint( playerid, 346.2153, -1648.3312, 33.1769, 5.0 );
else if( BusLinija[ playerid ] == 9 ) Muma_SetPlayerCheckpoint( playerid, 1119.5483, -1708.8313, 13.5159, 5.0 );
else if( BusLinija[ playerid ] == 10 ) Muma_SetPlayerCheckpoint( playerid, 921.5195, -1713.4103, 13.5967, 5.0 );
else if( BusLinija[ playerid ] == 11 ) {
SetVehicleToRespawn( GetPlayerVehicleID( playerid ) );
Muma_DisablePlayerCheckpoint( playerid );
TogglePlayerControllable( playerid, true );
BusLinija[ playerid ] = 0;
CheckpointStatus[ playerid ] = 0;
Muma_KillTimer( BusVozac[ playerid ] );
new bonus = random( 500 );
format( globalstring, sizeof( globalstring ), ""col_job"Uspjesno ste zavrsili bus liniju!\n\n"col_white"Plata: "col_job"3000$\n"col_white"Bonus: "col_job"%d$", bonus );
SPD( playerid, 0, DSMSG, D_NASLOV, globalstring, "Ok", "" );
PlayerInfo[ playerid ][ xPlatniRacun ] += (3000+bonus);
SavePlayer( playerid );
StaroVreme[ playerid ] = 0;
NovoVreme[ playerid ] = 0;
BussinesJobMoney( POSAO_BUSVOZAC, ((2000+bonus)/10) );
return 1;
}
TogglePlayerControllable( playerid, false );
BusVozac[ playerid ] = SetTimerEx( "UtovarBus", 5000, false, "d", playerid );
GameTextForPlayer( playerid, "~y~Stanica", 5000, 3 );
}
}
Re: Simple job bug/problem -
RogueDrifter - 14.02.2018
No... you need to show where the checkpoint is set thats the same code as above and its too vague,
You need to realize that OnPlayerEnterCheckpoint is called for every checkpoint so for EX if i wanna make a certain checkpoint say "hi" i'll do it like this:
PHP код:
CMD:msghi(playerid, prams[])
{
SetPlayerCheckPoint(playerid, x,y,z, range);//setting the CP
playermsgcp[playerid] = true;//to determine the CP
return 1;
}
that's for setting, when you enter:
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
if(playermsgcp[playerid])//if the CP was set for that player
{
SendClientMessage(playerid, -1, "hi");//send the msg
DisablePlayerCheckpoint(playerid);//disable the cP
playermsgcp[playerid] = false;//reset variable for next use.
}
return 1;
}
That's the basic idea, read that and compare to see where you went wrong.
On the other hand if you already knew what i explained above, show me where you set the player's CP and where is it called at the OPECP callback.
Re: Simple job bug/problem -
tbedy - 15.02.2018
tried on this way ...
but same problem
im not sure I understood you good... english is not my main language...sry for that
Код:
case 10: {
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) == 431 && GetPlayerState( playerid ) == 2 ) {
if( BusLinija[ playerid ] < 11 ) {
Muma_DisablePlayerCheckpoint( playerid );
BusLinija[ playerid ]++;
CheckpointStatus[ playerid ] = 14;
}
if( BusLinija[ playerid ] == 2 ){
Muma_SetPlayerCheckpoint( playerid, 963.2554, -1330.4203, 13.4962, 5.0 );
BusLinija[playerid] = 3;
SendClientMessage(playerid, 0xFFFF00AA, "*Crazy ED: Move your lazzy ass to bayside and deliver those crates!");
return 1;
}
if( BusLinija[ playerid ] == 3 ){
Muma_SetPlayerCheckpoint( playerid, 1222.1409, -1284.2852, 13.5143, 5.0 );
BusLinija[playerid] = 4;
SendClientMessage(playerid, 0xFFFF00AA, "*Crazy ED: Move your lazzy ass to bayside and deliver those crates!");
return 1;
}