random pos for NPC
#4

Okay i might solve this situation but there is huge bug, i have this code:
pawn Код:
public:: Valanda( playerid )
{
    new Float:DyleriuSpawn1[ ][ 4 ] =
    {
        { 254.7924,-158.8666,1.5703,29.9453 },
        { 644.3600,-511.2609,16.3359,8.0116 },
        { 1310.7725,165.4595,20.4609,205.8482 },
        { 2259.4260,64.7797,26.4844,49.5937 }
    };
    new Float:DyleriuSpawn2[ ][ 4 ] =
    {
        { 243.6889,-297.9287,1.5781,335.6656 },
        { 704.5399,-612.6599,16.3359,9.2649 },
        { 1317.1860,213.5444,19.5547,190.6865 },
        { -2176.0603,-2421.4243,30.6250,201.1717 }
    };
    new Float:DyleriuSpawn3[ ][ 4 ] =
    {
        { 206.9716,-102.9836,4.8965,89.1658 },
        { 819.0970,-562.1505,16.3359,176.8763 },
        { 1337.3336,203.7981,19.5547,174.0563 },
        { -2114.4004,-2422.6992,30.6250,124.1144 }
    };
    new Float:DyleriuSpawn4[ ][ 4 ] =
    {
        { 309.9570,45.7836,2.8272,258.9941 },
        { 1242.1256,212.1650,19.5547,85.0688 },
        { 2314.8311,53.3478,26.4812,306.5975 },
        { -2071.6045,-2565.0767,30.6301,14.9284 }
    };
    new npcname[ MAX_PLAYER_NAME ];
    GetPlayerName( playerid, npcname, sizeof( npcname ) );
    new rand1 = random( sizeof( DyleriuSpawn1 ) );
    new rand2 = random( sizeof( DyleriuSpawn2 ) );
    new rand3 = random( sizeof( DyleriuSpawn3 ) );
    new rand4 = random( sizeof( DyleriuSpawn4 ) );

    if( !strcmp( npcname, "Dyleris1", true ) )// Stumdo dumus
    {
        SetPlayerPos( playerid, DyleriuSpawn1[ rand1 ][ 0 ],DyleriuSpawn1[ rand1 ][ 1 ],DyleriuSpawn1[ rand1 ][ 2 ] );
        SetPlayerFacingAngle( playerid, DyleriuSpawn1[ rand1 ][ 3 ] );
    }
    if( !strcmp( npcname, "Dyleris2", true ) )// Dumai, extazy
    {
        SetPlayerPos( playerid, DyleriuSpawn2[ rand2 ][ 0 ],DyleriuSpawn2[ rand2 ][ 1 ],DyleriuSpawn2[ rand2 ][ 2 ] );
        SetPlayerFacingAngle( playerid, DyleriuSpawn2[ rand2 ][ 3 ] );
    }
    if( !strcmp( npcname, "Dyleris3", true ) )// LSD
    {
        SetPlayerPos( playerid, DyleriuSpawn3[ rand3 ][ 0 ],DyleriuSpawn3[ rand3 ][ 1 ],DyleriuSpawn3[ rand3 ][ 2 ] );
        SetPlayerFacingAngle( playerid, DyleriuSpawn3[ rand3 ][ 3 ] );
    }
    if( !strcmp( npcname, "Dyleris4", true ) )//Visko
    {
        SetPlayerPos( playerid, DyleriuSpawn4[ rand4 ][ 0 ],DyleriuSpawn4[ rand4 ][ 1 ],DyleriuSpawn4[ rand4 ][ 2 ] );
        SetPlayerFacingAngle( playerid, DyleriuSpawn4[ rand4 ][ 3 ] );
    }
    return true;
}
but only the first one bot whose first connect's the server is changing his position, others just standing in spawn position, how to solve that?
Reply


Messages In This Thread
random pos for NPC - by ancezas - 03.12.2013, 18:01
Re: random pos for NPC - by Scrillex - 03.12.2013, 18:11
Re: random pos for NPC - by ancezas - 03.12.2013, 18:34
Re: random pos for NPC - by ancezas - 03.12.2013, 20:14
Re: random pos for NPC - by ancezas - 04.12.2013, 05:27

Forum Jump:


Users browsing this thread: 2 Guest(s)