Working on PUBG
#1

im working on PUBG event in my GM

i have few problems...

Код:
// pubg 
enum PUBGjao {
	PUBGTime,
	pID
}
new PUBGInfo[ PUBGjao ];
Код:
forward PUBGTimeR();
forward PUBGTimeR( );
Код:
// ========================= PUBG timer
public PUBGTimeR()
{
	if( PUBGInfo[ pID ] == 1 ) {
		PUBGInfo[ PUBGTime ]--;
		switch( PUBGInfo[ PUBGTime ] ) {
			case 0: {
	            foreach(new i : Player) {
					if( PlayerCP[ i ] > 0 ) {
						TogglePlayerControllable( i, true );
						GameTextForPlayer( i ,"~g~GO GO GO!!!", 2000, 5 );
					}
				}
			}
			case 1: {
			    foreach(new i : Player) {
					if( PlayerCP[ i ] > 0 ) {
					    GameTextForPlayer( i ,"~r~1", 999, 5 );
					}
				}
			}
			case 2: {
			    foreach(new i : Player) {
					if( PlayerCP[ i ] > 0 ) {
					    GameTextForPlayer( i ,"~y~2", 999, 5 );
					}
				}
			}
			case 3: {
			    foreach(new i : Player) {
					if( PlayerCP[ i ] > 0 ) {
					    GameTextForPlayer( i ,"~b~3", 999, 5 );
					}
				}
			}
			case 8: {
			    format( globalstring, sizeof( globalstring ), ""col_orange"PUBG Event | "col_white"Event pocinje za {A6A6A6}5 sekundi {A6A6A6}[ /pubg ]" );
				SCMA( -1, globalstring );
			}
			case 13: {
			    format( globalstring, sizeof( globalstring ), ""col_orange"PUBG Event | "col_white"Imate {A6A6A6}10 "col_white"sekundi da se prijavite {A6A6A6}[ /pubg ]" );
				SCMA( -1, globalstring );
			}
		}
	}

}
Код:
public OnPlayerSpawn( playerid ) {

	PUBGInfo[ playerid ] = 0;
Код:
CMD:ubaciuinv( playerid, params[] ) {
	if( PUBGInfo[ playerid ] != 0 ) return GRESKA( playerid, "Ne mozes ubacivat u inventory dok si na PUBG eventu, koristiti [ /pubgnapusti ]");
Код:
CMD:inv( playerid, params[] ) {

	if( PUBGInfo[ playerid ] != 0 ) return GRESKA( playerid, "Ne mozes otvarati inventory dok si na PUBG eventu, koristiti [ /pubgnapusti ]");

/join

Код:
CMD:pubg( playerid, params[ ], help ) {
	if( PlayerCuffed[ playerid ] >= 1 ) return GRESKA( playerid, "Ne mozes na PUBG dok si cuffovan." );
    if( IgracZavezan[ playerid ] == true ) return GRESKA( playerid, "Ne mozes na PUBG dok si vezan." );
	if( PUBGInfo[ PUBGTime ] <= 3 ) return GRESKA( playerid, "Vrijeme za PUBG je isteklo");
	if( IsPlayerInAnyVehicle( playerid )  ) return GRESKA( playerid, "Morate biti na nogama da bi otisli na PUBG event." );
	if( GetPlayerState( playerid ) != PLAYER_STATE_ONFOOT ) return GRESKA( playerid, "Morate biti na nogama da bi otisli na PUBG event." );
	if( GetPlayerInterior( playerid ) != 0 ) return GRESKA( playerid, "Ne mozete koristiti u interijeru." );
	if( GetPlayerVirtualWorld( playerid ) != 0 ) return GRESKA( playerid, "Ne mozete koristiti u interijeru/vwu." );
	if( PUBGInfo[ playerid ] == 1 ) return GRESKA( playerid, "Vec ste na PUBG eventu." );
    if( PlayerInfo[ playerid ][ xZatvor ] >= 1 ) return GRESKA( playerid, "Ne mozete na event dok ste u Zatvoru ili Alkatrazu.");
    if( PUBGInfo[ pID ] == 0 ) return GRESKA( playerid, "Nije pokrenut PUBG event");
    else {

		new Random = random(sizeof(PubgSpawns));
		SetPlayerPos(playerid, PubgSpawns[Random][0], PubgSpawns[Random][1], PubgSpawns[Random][2]);
		PUBGInfo[ playerid ] = 1;
	}
	GetPlayerPos( playerid, PlayerPos[ playerid ][ 0 ], PlayerPos[ playerid ][ 1 ], PlayerPos[ playerid ][ 2 ] );
	return 1;
}
admin command: start pubg

Код:
CMD:ucitajpubg( playerid, params[ ], help ) {
	if( PlayerInfo[ playerid ][ xAdmin ] >= 1 || PlayerInfo[ playerid ][ xSupp ] >= 1 ) {
		if( !AdminDuty[ playerid ] ) return GRESKA( playerid, "Da bi koristili ovu komandu morate biti Admin na duznosti" );
		if( PUBGInfo[ pID ] == 1 ) return GRESKA( playerid, "Vec je pokrenut PUBG event");
		else {
			PUBGInfo[ pID ] = 1;
			PUBGInfo[ PUBGTime ] = MAX_TIME;
			format( globalstring, sizeof( globalstring ), "PUBG "col_orange"Event | "col_white"je poceo, imate {A6A6A6}20"col_white" sekundi da se pridruzite {A6A6A6}[ /pubg ]");
			SCMA( GLAVNA, globalstring );
			format( globalstring, sizeof( globalstring ), "***[Ucitavanje PUBG-a] %s | PUBG", ImeIgraca( playerid ));
			AdminPoruka( 0x6495EDAA, globalstring );
			CreateDroppedGun(31, 50, 7637.9922,-2619.3904,10.4161); // creates a M4 with 50 ammo at this location.
		}
	}
	return 1;
}
Player's command - leave pubg

Код:
CMD:pubgnapusti( playerid, params[] ) {
	if( PUBGInfo[ playerid ] == 1 ) return GRESKA( playerid, "Niste na PUBG eventu");
	if( PlayerInfo[ playerid ][ xZatvor ] >= 1 ) return GRESKA( playerid, "Ne mozete dok ste u Zatvoru ili Alkatrazu.");
	else {
		TogglePlayerControllable( playerid, true );
		SetPlayerVirtualWorld( playerid, 0 );
		PUBGInfo[ playerid ] = 0;
		PlayerCP[ playerid ] = 0;
		Muma_SetPlayerPos( playerid, PlayerPos[ playerid ][ 0 ], PlayerPos[ playerid ][ 1 ],  PlayerPos[ playerid ][ 2 ] );
		SetPlayerVirtualWorld( playerid, PlayerPosVW[ playerid ] );
		SetPlayerInterior( playerid, PlayerPosInt[ playerid ] );
	}
	return 1;
}
Reply
#2

PROBLEMS:
1. PUBGTimer doesn't work all, just part of him... when you go to pubg (cmd: pubg) it shuts down, doesn't show all of his

2. I need to type FEW! times BOTH CMDS (cmd: pubgnapusti & cmd: pubgugasi) to use cmd:inv again...
Reply
#3

PHP код:
forward PUBGTimeR();
forward PUBGTimeR( ); 
where do you have these and why are there 2 of them?

and also,those 2 cmds do nothing as i can see.they just check if pubg playerid is not 0 .can you atleast translate some of the cmds?
Reply
#4

The timer code has a logical flaw. Why are you saving the countdown in per-player variable, just save participation boolean as a per-player variable and use a global variable which stores the countdown.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)