How can I place a probability between two routes?
#1

Sorry for my bad English

Well, a few months ago I downloaded a RP base game mode to make a server, and I was doing the work. Everything is fine, I watched many tutorials and they helped me a lot. The problem is that when the player joins the job and places / rutabus (since it's a bus driver job), it just gives a route, which I did in the script. What I am looking for is to be able to make more routes, and that when the player places / rutabus, I give him one at random. Here my code


COMMAND:
PHP код:
COMMAND:rutabus(playeridcmdtext)
{
    if (!
IsPlayerInRangeOfPoint(playerid5.02011.9757,-2099.0300,13.5469))
    {
        return 
SendClientMessage(playerid0xFF0000FF"No estas cerca de el trabajo de chofer de larga distancia");
    }
    
micrerobb[playerid] = 1// This will change the variable, so we can use it later on with OnPlayerEnterCheckpoint
    
SetPlayerCheckpoint(playerid2013.0076,-2061.3867,13.273710.0); // This creates a checkpoint at the co?rdinates: "-269.1287,2610.6057,63.2069"
    
SendClientMessage(playerid0xFFFF00AA"Iniciaste la ruta de chofer de larga distancia");
    
SendClientMessage(playerid0xFFFF00AA"La ruta de hoy es Los Santos - BlueBerry");
    
SendClientMessage(playerid0xFFFF00AA"¡Ve a un bus y segui los checkpoints!");
    return 
1;

PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
        if(
micrerobb[playerid] == 1){
            
micrerobb[playerid] = 2;
            
SetPlayerCheckpoint(playerid,1495.5216,-1588.7761,13.1099,5);
              
SendClientMessage(playerid0xFFFF00AA"Los pasajeros ya subieron, ahora tenes que ir a la parada intermedia!");
            return 
1;
           }
           if(
micrerobb[playerid] == 2){
            
micrerobb[playerid] = 3;
            
SetPlayerCheckpoint(playerid,317.6990,-17.8283,1.3052,5);
            
SetTimerEx("pasajeros subiendo..."50000"i"playerid);
            
SendClientMessage(playerid0xFFFF00AA"¡Los pasajeros ya subieron!, ahora si, ve a la terminal de buses de BlueBerry");
            return 
1;
        }
           if(
micrerobb[playerid] == 3){
            
micrerobb[playerid] = 4;
            
SetPlayerCheckpoint(playerid,310.9017,-18.0067,1.3056,5);
            
SendClientMessage(playerid0xFFFF00AA"¡Bien hecho!, ahora tenemos que volver a Los Santos, ve al checkpoint");
            return 
1;
        }
           if(
micrerobb[playerid] == 4){
            
micrerobb[playerid] = 5;
            
SetPlayerCheckpoint(playerid,1601.3608,-1735.8271,13.1099,10);
            
SendClientMessage(playerid0xFFFF00AA"¡Los pasajeros ya subieron!, ahora si, vayamos a la parada intermedia");
            return 
1;
        }
           if(
micrerobb[playerid] == 5){
            
micrerobb[playerid] = 6;
            
SetPlayerCheckpoint(playerid,2028.4951,-2061.6758,13.2740,10);
            
SendClientMessage(playerid0xFFFF00AA"¡Bien hecho! Ahora vayamos a la terminal central de buses Los Santos");
            return 
1;
        }
           if(
micrerobb[playerid] == 6){
            
micrerobb[playerid] = 0;
            
SendClientMessage(playerid0xFFFF00AA"Bien hecho, espera que los pasajeros bajen");
            
SendClientMessage(playerid0xFFFF00AA"Felicidades!. Completaste la ruta correctamente. Recibiste $3000");
                        
GivePlayerMoney(playerid3000);
            
DisablePlayerCheckpoint(playerid);
            return 
1;
        }
     }
    return 
1;

My other route ...

PHP код:
        }
        if(
micrerobb2[playerid] == 1){
            
micrerobb2[playerid] = 2;
              
SetPlayerCheckpoint(playerid,1495.5216,-1588.7761,13.1099,5);
              
SendClientMessage(playerid0xFFFF00AA"Los pasajeros ya subieron, ahora tenes que ir a la parada intermedia!");
            return 
1;
           }
           if(
micrerobb2[playerid] == 2){
            
micrerobb2[playerid] = 3;
            
SetPlayerCheckpoint(playerid,317.6990,-17.8283,1.3052,5);
            
SetTimerEx("pasajeros subiendo..."50000"i"playerid);
            
SendClientMessage(playerid0xFFFF00AA"¡Los pasajeros ya subieron!, ahora si, ve a la terminal de buses de San Fierro");
            return 
1;
        }
           if(
micrerobb2[playerid] == 3){
            
micrerobb2[playerid] = 4;
            
SetPlayerCheckpoint(playerid,-235.1712,-2943.3865,-0.6991,5);
            
SendClientMessage(playerid0xFFFF00AA"¡Bien hecho!, ahora tenemos que volver a Los Santos, ve al checkpoint");
            return 
1;
        }
           if(
micrerobb2[playerid] == 4){
            
micrerobb2[playerid] = 5;
            
SetPlayerCheckpoint(playerid,1601.3608,-1735.8271,13.1099,10);
            
SendClientMessage(playerid0xFFFF00AA"¡Los pasajeros ya subieron!, ahora si, vayamos a la parada intermedia");
            return 
1;
        }
           if(
micrerobb2[playerid] == 5){
            
micrerobb2[playerid] = 6;
            
SetPlayerCheckpoint(playerid,2028.4951,-2061.6758,13.2740,10);
            
SendClientMessage(playerid0xFFFF00AA"¡Bien hecho! Ahora vayamos a la terminal central de buses Los Santos");
            return 
1;
        }
           if(
micrerobb2[playerid] == 6){
            
micrerobb2[playerid] = 0;
            
SendClientMessage(playerid0xFFFF00AA"Bien hecho, espera que los pasajeros bajen");
            
SendClientMessage(playerid0xFFFF00AA"Felicidades!. Completaste la ruta correctamente. Recibiste $3000");
                        
GivePlayerMoney(playerid3000);
            
DisablePlayerCheckpoint(playerid);
            return 
1;
        }
     }
    return 
1;

Returning to the question, how can I do when the player writes / rutabus assign one of the two routes?
I read what can be done with the dialogues, but my idea is not that the player chooses, but that it is aeleatoriamente. Thanks for your help beforehand
Reply
#2

Take a look at this. Also your system and the way you are doing it needs some major improvements. This is a dynamic system but instead is hard coded with copy/paste code.

https://sampforum.blast.hk/showthread.php?tid=662109
Reply
#3

It seems very good complement, maybe I use it later, but I think you did not understand my question. I have the command to start the bus driver's work, and when that command is executed, the route starts. I want that when the player puts the command more than one route.
Example:
I made the route Los Santos - Blueberry, when the player places the command to start the route, start that path.
I want to make more routes, and that when the player puts the command it will be randomized
Do you understand I'm sure you can, but I could not find how
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)