SA-MP Forums Archive
Unreachable Code - 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: Unreachable Code (/showthread.php?tid=410512)



Unreachable Code - Blackazur - 25.01.2013

Код:
    return SendClientMessageToAll( 0xB2FF7FFF, string );
    return GameTextForPlayer(playerid,"+4000$, +2 Score",2000,3);
//warning 225: unreachable code

Hi, Know everyone an Answer?


Re: Unreachable Code - Roach_ - 25.01.2013

Try this:
pawn Код:
return SendClientMessageToAll( 0xB2FF7FFF, string ), GameTextForPlayer( playerid, "+4000$, +2 Score", 2000, 3 );



AW: Unreachable Code - Blackazur - 25.01.2013

It works, but the GameText dont appear on the Screen. Where is the Problem?


Re: Unreachable Code - Roach_ - 25.01.2013

Try this then:
pawn Код:
SendClientMessageToAll( 0xB2FF7FFF, string );
GameTextForPlayer(playerid,"+4000$, +2 Score",2000,3);
return 1;
It should work now


AW: Unreachable Code - Blackazur - 25.01.2013

The GameText work still not, i dont know why, no Error come.


Re: Unreachable Code - Neil. - 25.01.2013

pawn Код:
SendClientMessageToAll( 0xB2FF7FFF, string );
new string[24];
format(string, sizeof(string), "+4000$, +2 Score");
GameTextForPlayer(playerid,string,3000,3);
return 1;



AW: Unreachable Code - Blackazur - 25.01.2013

Thx, will that work so too?

Код:
    SendClientMessageToAll( 0xB2FF7FFF, string );
    
    new str[24];
    format(str, sizeof(str), "+4000$, +2 Score");
    GameTextForPlayer(killerid,str,3000,3);
    
    new st[24];
    format(st, sizeof(st), "You died -3000$!");
    GameTextForPlayer(playerid,st,3000,3);
    return 1;
    }



Re: AW: Unreachable Code - Neil. - 25.01.2013

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
Thx, will that work so too?

Код:
    SendClientMessageToAll( 0xB2FF7FFF, string );
    
    new str[24];
    format(str, sizeof(str), "+4000$, +2 Score");
    GameTextForPlayer(killerid,str,3000,3);
    
    new st[24];
    format(st, sizeof(st), "You died -3000$!");
    GameTextForPlayer(playerid,st,3000,3);
    return 1;
    }
It should work as well.


AW: Unreachable Code - Blackazur - 25.01.2013

I tested it it appear not on the Screen, the Public is "OnPlayerDeath", is the Problem that it is an Filterscript, should i add it in my main Gamemode?


Re: AW: Unreachable Code - Neil. - 25.01.2013

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
I tested it it appear not on the Screen, the Public is "OnPlayerDeath", is the Problem that it is an Filterscript, should i add it in my main Gamemode?
For it to appear, you must have the killer and you yourself. Test it with someone, not by yourself alone.

Just for an example:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason); // Shows the kill in the killfeed/deathlog/death window
 
    if(killerid != INVALID_PLAYER_ID) // Valid killer, give cash+score
    {
        new str[24];
        format(str, sizeof(str), "+4000$, +2 Score");
        GameTextForPlayer(killerid,str,3000,3);
 
        GivePlayerMoney(killerid, +4000);
        GivePlayerScore(killerid, +2);
    }
 
    // Outside the check, handle stuff for playerid
    // if killerid was INVALID_PLAYER_ID the player killed themselves (i.e. falling)
    new st[24];
        format(st, sizeof(st), "You died -3000$!");
        GameTextForPlayer(playerid,st,3000,3);
    GivePlayerMoney(playerid, -3000);
   
   
   
    return 1;
}