#1

Hola estoy creando un mini gm zombie y quiero saber como le hago q cuando hagan spawn a los 30 segundo se elija cualquier id para ser zombie
Reply
#2

Aca te dejo un pequeсo script con la funcion para elejir un jugador al azar.
pawn Код:
#include <a_samp>

#define COUNT_BOTS  //comentar esta linea para que el script no cuente a los bots NPC.

new pCount;

public OnPlayerConnect(playerid)
{
    #if defined COUNT_BOTS
        pCount++;
    #else
        if(!IsPlayerNPC(playerid))
            pCount++;
       
    #endif
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    #if defined COUNT_BOTS
        pCount++;
    #else
        if(!IsPlayerNPC(playerid))
            pCount++;
    #endif
    return 1;
}

stock RandomUser()
{
    if(!pCount)
        return INVALID_PLAYER_ID;
    if(pCount < 2){
        new tmp, counter;
        while(!IsPlayerConnected(tmp)){
            if(tmp == GetMaxPlayers()){
                counter++;
                if(counter>=2)
                    return INVALID_PLAYER_ID;
                tmp=0;                 
            }
            tmp++;
        }
        return tmp;
    }
    new tmp = random(GetMaxPlayers());
    while(!IsPlayerConnected{tmp})tmp = random(GetMaxPlayers());
    return tmp;
}
Reply
#3

Esto asн lo dejo o que hago?

Quote:

IsPlayerNPC

Reply
#4

Quote:
Originally Posted by adrianxd
Посмотреть сообщение
Esto asн lo dejo o que hago?
Eso? Lo que te di es el codigo para la funcion, solo debes agregarlo como esta dentro de tu GM/FS (incluyendo el codigo de los callbacks)

PS:
cambia esta linea
pawn Код:
while(!IsPlayerConnected{tmp})tmp = random(GetMaxPlayers());
por esta otra:
pawn Код:
while(!IsPlayerConnected(tmp))tmp = random(GetMaxPlayers());
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)