SA-MP Forums Archive
Hello. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Hello. (/showthread.php?tid=485086)



Hello. - Aylan - 02.01.2014

Hi there, my name is ProAssasin. I've recently been working on a gm, just experimenting and I've had a HUGE problem. When I try to spawn, textdraws come but class selection doesn't appear. All I end up seeing is a view of the beach. Please help me, I'll post a picture of it in a second. I've been working on it for nearly 2 days and can't find a solution.


Re: Hello. - Aylan - 02.01.2014

Код:
public OnPlayerConnect( playerid )
{
    LoadPlayerTextDraws( playerid );			LoadBeachSpawn( playerid );
    InfoTD_MSG(playerid, 3000, "~w~Loading~w~~h~...");
    //PlayAudioStreamForPlayer( playerid, "" );
    admin3D[ playerid ] = Create3DTextLabel( "", ~1, 0.0, 0.0, 0.0, 50.0, 0, 1 );

	// ( Spam Protection )
	PlayerInfo[ playerid ][ Spawned ] = ( 0 );
    
    for(new i = 0; i < 30; i++) SendClientMessage( playerid, ~1, " " ); // Clear Chat
	session[ connections ] = session[ connections ] + 1;
    #if USE_ANTI_STEALER == true
	   	new str[ 100 ];
		gpci( playerid , str , sizeof( str ) );
		if( !strcmp( str , DISALLOWED_ADDRESS ,true ) )
		{
			SendClientMessage( playerid , ~1 ,""R"[ "O"Anti Stealer "R"]" );
			BanEx( playerid, "# Map Stealer / RakSampClient" );
	    }
    #endif

	for ( new i = 0; i < 12; i++ )
	    PlayerTextDrawShow( playerid, ConnectTD[ i ] );

	OnPlayerConnectEx( playerid );              //CheckPlayerAccount( playerid );
    gsString[ 0 ] = EOS;
    new connecting_ip[ 16 ];
	PlayerLogo[ playerid ] = false;
	GetPlayerIp( playerid, connecting_ip, 16 );
	if ( GetNumberOfPlayersOnThisIP( connecting_ip ) > MAX_CONNECTIONS_FROM_IP )
	{
	    format( gsString, 144, ">> Server-Security << :: IP Ban player '%s'. {FFFF00}Reason: Too many connections from this IP", PlayerName( playerid ) );
		SendClientMessageToAll( COLOR_ULTRARED, gsString );
	    BanEx( playerid, "# Bots Flood" );
	    return ( 1 );
	}
	format( gsQuery, 512, "SELECT * FROM `Banlist` WHERE `IP` = '%s' OR `Name` = '%s'", connecting_ip, PlayerName( playerid ) );
    mysql_query( gsQuery, THREAD_CHECK_BANS_LIST, playerid );
    TogglePlayerSpectating(playerid, true);
	LoadRemoveBuildings( playerid );
    return ( 1 );
}

public OnPlayerRequestClass( playerid, classid )
{
    for ( new i = 0; i < 12; i++ )
	    PlayerTextDrawHide( playerid, ConnectTD[ i ] );

	for ( new i = 0; i < 6; i++ )
	      TextDrawShowForPlayer( playerid, ServerPanel[ i ] );

	Announce( playerid, "~r~~h~S~w~~h~elect ~y~~h~S~w~~h~kin", 1000, 1 );
    SetPlayerPos( playerid, 381.7331, -1819.4648, 14.7004 );
    Streamer_UpdateEx( playerid, 381.7331, -1819.4648, 14.7004 );
	SetPlayerFacingAngle( playerid, 320.3514 );
	SetPlayerSpecialAction( playerid, 5 );
	return ( 1 );
}

public OnPlayerSpawn( playerid )
{
    AntiDeAMX( );
    if ( PlayerInfo[ playerid ][ DM_Event ] == 0 && PlayerInfo[ playerid ][ ActionID ] == 0 )
		SpawnProtection( playerid );

    if ( PlayerInfo[ playerid ][ FirstSpawn ] == 1 )
    {
        PlayerInfo[ playerid ][ FirstSpawn ] = ( 0 );
        PlayerInfo[ playerid ][ Spawned ] = ( 1 );
        ShowPlayerDialog( playerid, DIALOG_LANG, 0, ""GRI"Language "W"/ "GRI"Limba", String_Language( ), "(Romana)", "(English)" );
	}

    GivePlayerScore( playerid, 10 );
    SetPlayerInterior( playerid, 0 );
    SetPlayerSpecialAction( playerid, 0 );
    TextDrawShowForPlayer( playerid, helpTD );
    SetTimerEx( "hideHelpTD", 30000, false, "i", playerid );

	// ( Race System Debug )
	KillTimer( InfoTimer[ playerid ] );
    for ( new i = 0; i < 11; i++ )
   		PlayerTextDrawHide( playerid, Race_InfoTD[ i ] );

	gsString[ 0 ] = EOS;
    switch( PlayerInfo[ playerid ][ Level ] )
 	{
 	    case 0:
	 	{
		 	if( PlayerInfo[ playerid ][ Premium ] < 3 )
		 	{
			 	gsString = " ";
			}
			else
			{
			    gsString = ""O"DONATOR";
			}
		}
		case 10: gsString = ""S"Administrator";
		case 15: gsString = ""G"Helper";
		case 25: gsString = ""R"Co-Founder";
		case 30: gsString = ""R"Founder";
	}

    //Update3DTextLabelText( admin3D[ playerid ], ~1, gsString );
    //Attach3DTextLabelToPlayer( admin3D[ playerid ], playerid, 0.0, 0.0, ADMINTAG_HEIGHT );

    switch( PlayerInfo[ playerid ][ Rank ] )
    {
    	case 0: 					 SetPlayerArmour( playerid, 0 );
		case 1, 2, 3, 4, 5: 		 SetPlayerArmour( playerid, 10 );
	    case 6, 7, 8, 9, 10:		 SetPlayerArmour( playerid, 21 );
	    case 11, 12, 13, 14, 15:	 SetPlayerArmour( playerid, 33 );
	    case 16, 17, 18, 19, 20, 21: SetPlayerArmour( playerid, 45 );
	    case 22, 23, 24:			 SetPlayerArmour( playerid, 64 );
	    case 25, 26, 27, 28, 29:	 SetPlayerArmour( playerid, 85 );
	    case 30, 31, 32, 33: 		 SetPlayerArmour( playerid, 100 );
	}
	Jail_EvadeCheck( playerid );
	Freeze_EvadeCheck( playerid );
    PlayerLogo[ playerid ] = true;
	if ( PlayerInfo[ playerid ][ UseSkin ] == 1 )
		SetPlayerSkin( playerid, PlayerInfo[ playerid ][ FavSkin ] );

	if(Iter_Contains(GodList, playerid) == 1)
		SetPlayerHealth( playerid, FLOAT_INFINITY );

	if ( PlayerInfo[ playerid ][ Use_Attach ] == 1 )
	{
	    for ( new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++ )
		{
	        SetPlayerAttachedObject( playerid, i, Attach_Info[ playerid ][ i ][ ao_model ], Attach_Info[ playerid ][ i ][ ao_bone ],
										          Attach_Info[ playerid ][ i ][ ao_x ],  Attach_Info[ playerid ][ i ][ ao_y ],  Attach_Info[ playerid ][ i ][ ao_z ],
										          Attach_Info[ playerid ][ i ][ ao_rx ], Attach_Info[ playerid ][ i ][ ao_ry ], Attach_Info[ playerid ][ i ][ ao_rz ],
										          Attach_Info[ playerid ][ i ][ ao_sx ], Attach_Info[ playerid ][ i ][ ao_sy ], Attach_Info[ playerid ][ i ][ ao_sz ] );
	    }
	}
    if ( PlayerInfo[ playerid ][ HideTDSSSS ] == 0 )
    {
	    for ( new i = 0; i < 6; i++ )
     		TextDrawShowForPlayer( playerid, ServerPanel[ i ] );

	    TextDrawShowForPlayer( playerid, TeleTDD );
	    TextDrawShowForPlayer( playerid, Forum );
	    //TextDrawShowForPlayer( playerid, Random_TD_Texts );
    }
    if( strlen( SpawnInDM[ playerid ] ) < 2 )
        PlayerInfo[ playerid ][ ActionID ] = 0;
    else
    {
        PlayerInfo[ playerid ][ ActionID ] = 0;
        PlayerInfo[ playerid ][ NoTDShow ] = 1;
        //SetPlayerWorldBounds( playerid, 20000.0000, -20000.0000, 20000.0000, -20000.0000 );
        CallRemoteFunction( "OnPlayerCommandText", "is", playerid, SpawnInDM[ playerid ] );
        return ( 1 );
    }
	if ( PlayerInfo[ playerid ][ DM_Event ] != 1 )
	{
	    if ( Users[ playerid ][ gang ] != 0 )
			SetupPlayerForGang( playerid, Users[ playerid ][ gang ] );

	    else if ( PlayerInfo[ playerid ][ ID ] != 0 )
		{
		    if ( GetPVarFloat( playerid, "vSpawn_A" ) == 0.0 )
			{
				SetPlayerSkin( playerid, PlayerInfo[ playerid ][ skin ] );
				SetPlayerPos( playerid, PlayerInfo[ playerid ][ spawnX ], PlayerInfo[ playerid ][ spawnY ], PlayerInfo[ playerid ][ spawnZ ] );
			}
			else
			{
	            SetPlayerPos( playerid, GetPVarFloat( playerid, "vSpawn_X" ), GetPVarFloat( playerid, "vSpawn_Y" ), GetPVarFloat( playerid, "vSpawn_Z" ) );
				SetPlayerFacingAngle( playerid, GetPVarFloat( playerid, "vSpawn_A" ) );
			}
			SetPlayerFacingAngle( playerid, PlayerInfo[ playerid ][ spawnA ] );
			GivePlayerWeapon( playerid, PlayerInfo[ playerid ][ Weap1 ], 200 );
			GivePlayerWeapon( playerid, PlayerInfo[ playerid ][ Weap2 ], 200 );
			GivePlayerWeapon( playerid, PlayerInfo[ playerid ][ Weap3 ], 200 );
			GivePlayerWeapon( playerid, PlayerInfo[ playerid ][ Weap4 ], 200 );
			GivePlayerWeapon( playerid, PlayerInfo[ playerid ][ Weap5 ], 200 );
			GivePlayerWeapon( playerid, PlayerInfo[ playerid ][ Weap6 ], 200 );
		}
		else
			SetPlayerRandomSpawn( playerid );
	}
	else
	    SetPlayerRandomSpawn( playerid );

    return ( 1 );
}



Re: Hello. - Aylan - 02.01.2014

Bump. I really need help, please help me.


Re : Hello. - Flobesst - 02.01.2014

Hi,

I can see this:
Код:
TogglePlayerSpectating(playerid, true);
Under your OnPlayerConnect() callback. This is why you can't see the class selection.

If you want the player to be in spectating mode, put TogglePlayerSpectating under OnPlayerSpawn for example


Re: Re : Hello. - Aylan - 02.01.2014

Quote:
Originally Posted by Flobesst
Посмотреть сообщение
Hi,

I can see this:
Код:
TogglePlayerSpectating(playerid, true);
Under your OnPlayerConnect() callback. This is why you can't see the class selection.

If you want the player to be in spectating mode, put TogglePlayerSpectating under OnPlayerSpawn for example
Thank you so much, it's working! But I have a new problem now. I can't see any skins and when I click spawn, I crash.


Re : Hello. - Flobesst - 02.01.2014

I can't see your OnGameModeInit() callback but I'm pretty sure it's because you don't have any class defined.

Everything you need is here:
https://sampwiki.blast.hk/wiki/AddPlayerClass


Re: Hello. - driftg0d - 02.01.2014

If you can't see any skins, it might be because of the camera position and lookat.

Check these out:

Quote:
https://sampwiki.blast.hk/wiki/SetPlayerCameraLookAt
https://sampwiki.blast.hk/wiki/SetPlayerCameraPos
and add them on "OnPlayerRequestClass"


Re: Hello. - Aylan - 03.01.2014

Great, I see the Skins but when I click spawn, I crash.


Re: Hello. - Aylan - 03.01.2014

Код:
public OnPlayerRequestSpawn( playerid )
{
	DestroyBeachSpawn( playerid );
	StopAudioStreamForPlayer( playerid );
	CallRemoteFunction( "OnPlayerCommandText", "is", playerid, "/audiomsgoff" );
    return ( 1 );
}



Re : Hello. - Flobesst - 03.01.2014

I'm not sure about that but maybe you can't call a callback as a remote function. Try to remove your CallRemoteFunction(). If you don't crash anymore without this function, it means that the problem comes from here.

Otherwise, what do you mean exactly by "I crash" ?