Jump to content
  • 0

pomoc Print help


DominusKristus

Dotaz

Zdravím pawnocz mám problém v rámci tohto kodu :

 

public OnPlayerDisconnect(playerid, reason)
{
printf("OnPlayerDisconnect(%d (%s))", playerid);
new pName[30], string[256];
GetPlayerName(playerid, pName, 30);
format(string, 256, "[SERVER] Hráč %s sa odpojil.", pName);
SendClientMessageToAll(COLOR_RED, string);
return 1;
}

Chcel som aby mi do server_log.txt vypísalo [17:51:44] OnPlayerDisconnect (hračove ID) (hračove meno)

Ale ono to nejak píše toto [17:52:29] OnPlayerDisconnect(0 ()) prosím poradte mi som bezradný rád by som si to dal aj na nejaké príkazy nech z logu vidím kto čo zadával na servery. S pozdravom Dominus :)

 

 


 

 

Link to comment
Share on other sites

11 odpovědí na tuto otázku

Recommended Posts

  • 0
  • Globální moderátor

public OnPlayerDisconnect(playerid, reason)
{
new pName[30], string[256];
GetPlayerName(playerid, pName, 30);

printf("OnPlayerDisconnect(%d (%s))", playerid,pName);
format(string, 256, "[sERVER] Hráč %s sa odpojil.", pName);
SendClientMessageToAll(COLOR_RED, string);
return 1;
}

 

Všimni si, kam jsem to posunul a co jsem přidal

Link to comment
Share on other sites

  • 0

Skúšal som to týmto štýlom ale zabudol som na GetPlayerName(playerid, pName, 30); :( ... Ďakujem a ešte ak sa môžem spýtať ako docielim toho aby peniaze hráča sa zobrazovali v TAB. Ak nejaký link na topic alebo rovno kod tak budem vďačný a ešte sa spýtam dalo by sa do toho printf("OnPlayerDisconnect(%d (%s))", playerid,pName); pridať aj print jeho IP ?

 

Ďakujem HighPrint

Link to comment
Share on other sites

  • 0

public OnPlayerDisconnect (playerid, reason)
{
    new pName[MAX_PLAYER_NAME], string[256], pIP[16];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);

    GetPlayerIP (playerid, pIP, 16);

    printf ("OnPlayerDisconnect (%d (%s) IP:%s)", playerid, pName, pIP);
    format(string, 256, "[sERVER] Hráč %s sa odpojil.", pName);
    SendClientMessageToAll(COLOR_RED, string);
    return 1;
}

Link to comment
Share on other sites

  • 0

Oki Ďakujem KuboSK :) ale hádže mi tam ešte error 017: undefined symbol "GetPlayerIP"

 

 

a teraz našiel som Script na penazie v skore tabulke zde a ked nahodím ten timer tak mi nahodí 

error 017: undefined symbol "playerid"

neviem si s tým poradiť prosím o help takto vyzerá ten public 

public Score()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) SetPlayerScore(i,GetPlayerMoney(playerid));}
return 1;
}
Link to comment
Share on other sites

  • 0
public Score(playerid)
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) SetPlayerScore(i,GetPlayerMoney(playerid));}
return 1;
}

 

Toto som presne skúšal a hádže to další error 025: function heading differs from prototype

Link to comment
Share on other sites

  • 0

hore do módu

forward Score(playerid)

 

error 025: function heading differs from prototype = funkcie nadpis sa líši od prototypu (google translate) t.j. že parametre vo forward a public su rozdielne

Link to comment
Share on other sites

  • 0

hezký že neháže errory ale záleží jestly to funguje jak má
když máš kód
 

public Score(playerid)
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) SetPlayerScore(i,GetPlayerMoney(playerid));}
return 1;
}

kde máš tedy cyklus na id hráčů tj proměnná i a najednou tam je playerid tam nemá co dělat navíc úplně zbytečný pokud public/callback není zavolán pomocí SetTimerEx
takže playerid by mělo vždy hodnotu 0 a všem hráčům by se v tabulce po zmáčknutí TAB objevili peníze toho hráče s id 0
takže forward nech
 

forward Score();

a kód po úpravě

public Score()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) SetPlayerScore(i,GetPlayerMoney(i));}
return 1;
}

a settimer dej tak na 4 sekundy v OnGameModeInit

SetTimer("Score",4000,true);

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...