Script help
#1

How i can make this two functions in one'

First
PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
    {
    new 
msg[255];
    if     (
newstate==PLAYER_STATE_DRIVER)
        {
        if (
GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
            {
            if     (
avisado[playerid]==-1)
                {
                
GameTextForPlayer(playerid,"~w~Press ~b~Buttom 2~n~~w~to start the ~n~~r~TAXI~w~ Minimissions.",3000,5);
                }
            else
                {
                
KillTimer(avisado[playerid]);
                
avisado[playerid]=-1;
                }
            }
        }
    if     (
newstate==PLAYER_STATE_ONFOOT)
        {
        if     ((
playerInMiniMission[playerid]>0)&&(avisado[playerid]==-1))
            {
            
GameTextForPlayer(playerid,"~w~You have ~r~10 sec ~n~~w~ to enter a ~r~TAXI",3000,4);
            
avisado[playerid]=SetTimerEx("terminarMission",10000,0,"%d",playerid);
            }
        if     (
OnTaxiAsPassenger[playerid]!=-1)
            {
            new 
taxista OnTaxiAsPassenger[playerid];
            new 
name[MAX_PLAYER_NAME];
            
GetPlayerName(taxista,name,MAX_PLAYER_NAME);
            
OnTaxiAsPassenger[playerid]=-1;
            new 
viaje CostoDelViaje[playerid];
            
format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~taxi~w~ ride.",name,viaje);
            
GameTextForPlayer(playerid,msg,3000,4);
            
format(msg,sizeof(msg),"~w~You get ~r~$%d~w~ ~n~for the ~r~taxi~w~ ride.",viaje);
            
GameTextForPlayer(taxista,msg,3000,4);
            
GivePlayerMoney(playerid,-viaje);
            
GivePlayerMoney(taxista,viaje);
            
cantidadPasajeros--;
            if     (
cantidadPasajeros==0)
                {
                
KillTimer(caidadefichaTimer);
                }
            }
        }
    if     (
newstate==PLAYER_STATE_PASSENGER)
        {
        if (
GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
            {
            new 
i=0;
              while     (
i<MAX_PLAYERS)
                      {
                      if     ((
playerInMiniMission[i]==1)&&(GetPlayerState(i)==PLAYER_STATE_DRIVER))
                          {
                        if     (
GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
                            {
                            new 
name[MAX_PLAYER_NAME];
                            
GetPlayerName(i,name,MAX_PLAYER_NAME);
                            
contador[i]++;
                            
format(msg,sizeof(msg),"~w~You have gotten into ~n~~g~%s's ~r~TAXI~w~",name);
                            
GameTextForPlayer(playerid,msg,3000,4);
                            
format(msg,sizeof(msg),"~w~You have one new~n~~r~PASENGER~w~");
                            
GameTextForPlayer(playerid,msg,3000,4);
                            
OnTaxiAsPassenger[playerid]=i;
                            
CostoDelViaje[playerid]=BAJADA_DE_BANDERA;
                            if     (
cantidadPasajeros==0)
                                {
                                
caidadefichaTimer=SetTimer("caidadeficha",30000,1);
                                }
                            
cantidadPasajeros++;
                            
i=MAX_PLAYERS;
                            }
                          }
                      
i++;
                      }
            }
        }
    return 
1;
    }

The second

PHP код:
public OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        if(
LicenseInfo[playerid][Car] < 1)
        {
            switch(
GetVehicleModel(GetPlayerVehicleID(playerid)))
            {
                case 
430417425446452453454464465469472473476484487488493497501511512513519553563577592593595447//Vehicle IDs.
                
{
                    
SendClientMessage(playerid0xFF6347AA"111111111111111111111111111111!");
                    
RemovePlayerFromVehicle(playerid);
                }
            }
        }
    }
    return 
1;

Reply
#2

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    new msg[255];
    if     (newstate==PLAYER_STATE_DRIVER)
        {
        if(LicenseInfo[playerid][Car] < 1)
        {
            switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
            {
                case 430, 417, 425, 446, 452, 453, 454, 464, 465, 469, 472, 473, 476, 484, 487, 488, 493, 497, 501, 511, 512, 513, 519, 553, 563, 577, 592, 593, 595, 447: //Vehicle IDs.
                {
                    SendClientMessage(playerid, 0xFF6347AA, "111111111111111111111111111111!");
                    RemovePlayerFromVehicle(playerid);
                }
            }
        }
        if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
            {
            if     (avisado[playerid]==-1)
                {
                GameTextForPlayer(playerid,"~w~Press ~b~Buttom 2~n~~w~to start the ~n~~r~TAXI~w~ Minimissions.",3000,5);
                }
            else
                {
                KillTimer(avisado[playerid]);
                avisado[playerid]=-1;
                }
            }
        }
    if     (newstate==PLAYER_STATE_ONFOOT)
        {
        if     ((playerInMiniMission[playerid]>0)&&(avisado[playerid]==-1))
            {
            GameTextForPlayer(playerid,"~w~You have ~r~10 sec ~n~~w~ to enter a ~r~TAXI",3000,4);
            avisado[playerid]=SetTimerEx("terminarMission",10000,0,"%d",playerid);
            }
        if     (OnTaxiAsPassenger[playerid]!=-1)
            {
            new taxista = OnTaxiAsPassenger[playerid];
            new name[MAX_PLAYER_NAME];
            GetPlayerName(taxista,name,MAX_PLAYER_NAME);
            OnTaxiAsPassenger[playerid]=-1;
            new viaje = CostoDelViaje[playerid];
            format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~taxi~w~ ride.",name,viaje);
            GameTextForPlayer(playerid,msg,3000,4);
            format(msg,sizeof(msg),"~w~You get ~r~$%d~w~ ~n~for the ~r~taxi~w~ ride.",viaje);
            GameTextForPlayer(taxista,msg,3000,4);
            GivePlayerMoney(playerid,-viaje);
            GivePlayerMoney(taxista,viaje);
            cantidadPasajeros--;
            if     (cantidadPasajeros==0)
                {
                KillTimer(caidadefichaTimer);
                }
            }
        }
    if     (newstate==PLAYER_STATE_PASSENGER)
        {
        if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 420)
            {
            new i=0;
              while     (i<MAX_PLAYERS)
                      {
                      if     ((playerInMiniMission[i]==1)&&(GetPlayerState(i)==PLAYER_STATE_DRIVER))
                          {
                        if     (GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid))
                            {
                            new name[MAX_PLAYER_NAME];
                            GetPlayerName(i,name,MAX_PLAYER_NAME);
                            contador[i]++;
                            format(msg,sizeof(msg),"~w~You have gotten into ~n~~g~%s's ~r~TAXI~w~",name);
                            GameTextForPlayer(playerid,msg,3000,4);
                            format(msg,sizeof(msg),"~w~You have one new~n~~r~PASENGER~w~");
                            GameTextForPlayer(playerid,msg,3000,4);
                            OnTaxiAsPassenger[playerid]=i;
                            CostoDelViaje[playerid]=BAJADA_DE_BANDERA;
                            if     (cantidadPasajeros==0)
                                {
                                caidadefichaTimer=SetTimer("caidadeficha",30000,1);
                                }
                            cantidadPasajeros++;
                            i=MAX_PLAYERS;
                            }
                          }
                      i++;
                      }
            }
        }
    return 1;
    }
That should work.
Reply
#3

no this didn't work
Reply
#4

Quote:
Originally Posted by boyan96
Посмотреть сообщение
no this didn't work
If this is the case, they didn't work before, as i simply added the if statement from one to the other, without fail and/or errors.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)