random pos for NPC
#1

Hi, i want to create that the npc's will randomly change they position every hour, i have 4 npc's for that script, and i whant to add variable to them when they change they position, so every positinion need to have they variable, how to do that?

BTW i have this code without variable's:
pawn Код:
public:: Valanda( playerid )
{
    new Float:DyleriuSpawn[][4] =
    {
        { 308.1694,   -192.6254,  1.5781,  283.7243 },
        { 254.7924,   -158.8666,  1.5703,  29.9453  },
        { 243.6889,   -297.9287,  1.5781,  335.6656 },
        { 206.9716,   -102.9836,  4.8965,  89.1658  },
        { 309.9570,   45.7836,    2.8272,  258.9941 },
        { 644.3600,   -511.2609,  16.3359, 8.0116   },
        { 704.5399,   -612.6599,  16.3359, 9.2649   },
        { 819.0970,   -562.1505,  16.3359, 176.8763 },
        { 1254.4191,  241.4952,   19.5547, 13.9415  },
        { 1242.1256,  212.1650,   19.5547, 85.0688  },
        { 1310.7725,  165.4595,   20.4609, 205.8482 },
        { 1317.1860,  213.5444,   19.5547, 190.6865 },
        { 1337.3336,  203.7981,   19.5547, 174.0563 },
        { 2314.8311,  53.3478,    26.4812, 306.5975 },
        { 2259.4260,  64.7797,    26.4844, 249.5937 },
        { -2176.0603, -2421.4243, 30.6250, 201.1717 },
        { -2114.4004, -2422.6992, 30.6250, 124.1144 },
        { -2071.6045, -2565.0767, 30.6301, 14.9284  }

    };
    new npcname[ MAX_PLAYER_NAME ];
    GetPlayerName( playerid, npcname, sizeof( npcname ) );
    new rand = random( sizeof( DyleriuSpawn ) );
   
    if( !strcmp( npcname, "Dyleris1", true ) )// Stumdo dumus
    {
        SetPlayerPos( playerid, DyleriuSpawn[ rand ][ 0 ], DyleriuSpawn[ rand ][ 1 ], DyleriuSpawn[ rand ][ 2 ] );
        SetPlayerFacingAngle( playerid, DyleriuSpawn[ rand ][ 3 ] );
    }
    if( !strcmp( npcname, "Dyleris2", true ) )// Dumai, extazy
    {
        SetPlayerPos( playerid, DyleriuSpawn[ rand ][ 0 ], DyleriuSpawn[ rand ][ 1 ], DyleriuSpawn[ rand ][ 2 ] );
        SetPlayerFacingAngle( playerid, DyleriuSpawn[ rand ][ 3 ] );
    }
    if( !strcmp( npcname, "Dyleris3", true ) )// LSD
    {
        SetPlayerPos( playerid, DyleriuSpawn[ rand ][ 0 ], DyleriuSpawn[ rand ][ 1 ], DyleriuSpawn[ rand ][ 2 ] );
        SetPlayerFacingAngle( playerid, DyleriuSpawn[ rand ][ 3 ] );
    }
    if( !strcmp( npcname, "Dyleris4", true ) )//Visko
    {
        SetPlayerPos( playerid, DyleriuSpawn[ rand ][ 0 ], DyleriuSpawn[ rand ][ 1 ], DyleriuSpawn[ rand ][ 2 ] );
        SetPlayerFacingAngle( playerid, DyleriuSpawn[ rand ][ 3 ] );
    }
    return true;
}
pawn Код:
SetTimer( "Valanda", 1000, true );
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)