Would you like to react to this message? Create an account in a few clicks or log in to continue.

    [TUT]string/spawn pred nemocnicou

    avatar
    dajmon
    Nováčik


    Posts : 18
    Join date : 26.04.2011

    [TUT]string/spawn pred nemocnicou Empty [TUT]string/spawn pred nemocnicou

    Odoslať pre dajmon Ut apríl 26, 2011 10:15 am

    takze mam tu dalsi dam vam tu aj nejake funkcie tut:
    naco sluzi string??...
    ak chceme aby sa zobrazovalo hracovo meno kolko ste zabil a pod.
    string sa dava do formatov... a to format(string, sizeof(string), "test",funkcie);
    ok tam davate text a to ked chcete dat aby sa zobrazilo cislo %d ak slovo %s ukazeme si obidve priklady a tam jak je funkcie no tam vase premeni a pod.
    no a teraz priklady Very Happy :
    tak trebars ked hrac pride na server...
    do OnPlayerConnect
    kód:
    new string[256];//nadefinuje string toto 256 je kolko pismen (aby nezatazovalo server)
    format(string, sizeof(string), "Hráč %s[%d] prišiel na server", PlayerName(playerid),playerid);
    SendClientMessageToAll(0xFFFF00AA, string);
    no a to si mozete dat aj do OnPlayerDisconnect
    no a teraz si zrobime status no:
    hore :
    kód:
    new zabil[MAX_PLAYERS];
    do OnPlayerDeath
    kód:
    zabil[killerid] += 1;//killerid aby to dalo tomu co zabil a +=1 aby mu to pripocitalo a nie nastavilo
    a do prikazu napr. /stat
    do OnPlayerCommandText
    kód:
    dcmd(stat,4,cmdtext);
    no a dole do modu:
    kód:
    dcmd_stat(playerid, params[])
    {
    #pragma unused params
    new string[600];
    format(string,sizeof(string),"status:zabil si :%d",zabil[playerid]);
    SendClientMessage(COLOR_CERVENA,string);
    return 1;
    }
    ked nechcete aby sa mu to dalo do chatu ale do dialogu tak namiesto SendClientMessage:
    kód:
    ShowPlayerDialog(playerid,id dialogu,DIALOG_STYLE_MSGBOX,"Informace:",string,"OK","");

    no a spawn pred nemocnicou:
    hore:
    kód:
    new death[MAX_PLAYERS];
    do OnPlayerDeath
    kód:
    death[playerid] = 1; //nastavime mu death na 1
    do OnPlayerSpawn
    kód:
    if(death[playerid]==1)
    {
    SetPlayerPos(playerid,x,y,z);//suradnice nemocnice
    //tu si mozete este nieco doplnit napr. GivePlayerMoney(playerid,-100); akoze poplatok
    SendClientMessage(playerid,COLOR_CERVENA,"umrel si");// napise mu spravu
    death[playerid]=0;//nastavi mu premenu na 0 aby pri najblisom umrti zase sa spawnol pred nemocnicov
    }

    //to by malo byt vsetko zatial sa majte Very Happy

      Práve je Ut november 26, 2024 7:24 pm