SA-MP Forums Archive
What can be wrong? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What can be wrong? (/showthread.php?tid=628726)



What can be wrong? - sscarface - 14.02.2017

Код:
public terminarMission(playerid)
{
        new msg[256];
        format(msg,sizeof(msg),"~r~Taxi job cancelled ~w~And You carried ~y~%d~w~ pasengers.",contador[playerid]);
        GameTextForPlayer(playerid,msg,3000,4);
        playerInMiniMission[playerid]=-1;
        avisado[playerid]=-1;
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid,name,MAX_PLAYER_NAME);
        format(msg,sizeof(msg),"%s (%d) is no longer a taxi drive.",name, playerid);
        SendClientMessageToAll(GREEN, msg);
        SendClientMessage(playerid,RED,"Taxi Job Cancelled.");
        GetPlayerName(playerid,name,MAX_PLAYER_NAME);
        for (new i=0;i<MAX_PLAYERS;i++)
        {
             if(playerid!=i)
             {
                    SendClientMessage(i,0xFFFF00AA," ");
                    SendClientMessage(i,0xFFFF00AA,msg);
             }
        }
        for (new i=0;i<MAX_PLAYERS;i++)
        {
                if(OnTaxiAsPassenger[i]==playerid)
                {
                        new taxista = playerid;
                        OnTaxiAsPassenger[i]=-1;
                        new viaje=CostoDelViaje[i];
                        format(msg,sizeof(msg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~taxi~w~ ride.",name,viaje);
                        GameTextForPlayer(i,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);
                        GivePlayerCashEx(i,-viaje);
                        GivePlayerCashEx(taxista,viaje);
                        cantidadPasajeros--;
                        if(cantidadPasajeros==0)
                        {
                                KillTimer(caidadefichaTimer);
                        }
                }
        }
        contador[playerid]=0;
        return 1;
}
Код:
(7779) : warning 219: local variable "msg" shadows a variable at a preceding level



Re: What can be wrong? - Immortal99 - 14.02.2017

Did u define new msg[256]; twice?
Eg:
new msg[256];
new msg[256];

Try making it like:
new msg[256];
new msgtwo[256];


Re: What can be wrong? - StrikerZ - 14.02.2017

PHP код:
public terminarMission(playerid)
{
        new 
msgg[256];
        
format(msgg,sizeof(msgg),"~r~Taxi job cancelled ~w~And You carried ~y~%d~w~ pasengers.",contador[playerid]);
        
GameTextForPlayer(playerid,msgg,3000,4);
        
playerInMiniMission[playerid]=-1;
        
avisado[playerid]=-1;
        new 
name[MAX_PLAYER_NAME];
        
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
        
format(msgg,sizeof(msgg),"%s (%d) is no longer a taxi drive.",nameplayerid);
        
SendClientMessageToAll(GREENmsgg);
        
SendClientMessage(playerid,RED,"Taxi Job Cancelled.");
        
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
        for (new 
i=0;i<MAX_PLAYERS;i++)
        {
             if(
playerid!=i)
             {
                    
SendClientMessage(i,0xFFFF00AA," ");
                    
SendClientMessage(i,0xFFFF00AA,msgg);
             }
        }
        for (new 
i=0;i<MAX_PLAYERS;i++)
        {
                if(
OnTaxiAsPassenger[i]==playerid)
                {
                        new 
taxista playerid;
                        
OnTaxiAsPassenger[i]=-1;
                        new 
viaje=CostoDelViaje[i];
                        
format(msgg,sizeof(msgg),"~w~You pay to ~g~%s ~n~~r~$%d~w~ for the ~r~taxi~w~ ride.",name,viaje);
                        
GameTextForPlayer(i,msgg,3000,4);
                        
format(msgg,sizeof(msgg),"~w~You get ~r~$%d~w~ ~n~for the ~r~taxi~w~ ride.",viaje);
                        
GameTextForPlayer(taxista,msgg,3000,4);
                        
GivePlayerCashEx(i,-viaje);
                        
GivePlayerCashEx(taxista,viaje);
                        
cantidadPasajeros--;
                        if(
cantidadPasajeros==0)
                        {
                                
KillTimer(caidadefichaTimer);
                        }
                }
        }
        
contador[playerid]=0;
        return 
1;




Re: What can be wrong? - sscarface - 14.02.2017

Yeah fixed it but thanks for responding me fast.