Satla-Zone
התחברות
+ הגב לנושא
מציג תוצאות 1 עד 6 מתוך 6

אשכול: מדריך| לבנות מערכת גישות

  1. #1
    הסמל האישי של CPD
    CPD CPD מנותק טירון
    תאריך הצטרפות
    17/02/09
    הודעות
    72
    קיבל לייק
    0 פעמים

    מדריך| לבנות מערכת גישות

    זה מדריך קצר ולעניין אז מתחילים:
    למעלה עושים new חדש: .

    קוד PHP:
    new admin[MAX_PLAYERS]; 

    והגדרה:
    קוד PHP:
    #define MAX_admin 1 

    בפבליק:

    קוד PHP:
    public OnPlayerConnect(playerid) 
    כותבים למעלה בפבליק
    קוד PHP:
    admin[playerid]=0; 





    עכשיו אם אתה רוצה פקודה שתהיה רק לאדמין אתה מוספים לה את זה:
    קוד PHP:
     public OnPlayerConnect(playerid) 
    קוד PHP:
    new name[MAX_PLAYER_NAME+1]; GetPlayerName(playerid, name, sizeof(name)); if(strcmp(name,"[Hyper]AAvivB",true) == 0) { admin[playerid]=1; return 1; } 
    וזה בעצם עושה שכל פעם ש Hyper AAvivB נכנס לשרת זה שם לו גישות או שאתם יכולים לעשות את זה עם פקודה מסוימת:
    קוד PHP:
    if(strcmp(cmdtext, "/command", true) == 0) { admin[playerid]=1; return 1; } 


    עכשיו אם אתה רוצה פקודה שתהיה רק לאדמין אתה מוספים לה את זה:
    קוד PHP:
    if(admin[playerid] == 0) { SendClientMessage(playerid,COLOR_GREY," text"); return 1; } 


    דוגמא :
    קוד PHP:
    if(strcmp(cmd,"/goto",true) == 0) { new tmp[256]; new id; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_GREY,"USAGE: /goto [id] "); return 1; } id = strval(tmp); if(!IsPlayerConnected(id)) { SendClientMessage(playerid,COLOR_WHITE,"invalid ID"); return 1; } if(admin[playerid] == 0) { SendClientMessage(playerid,COLOR_GREY,"you are not admin"); return 1; } if(id == playerid) { SendClientMessage(playerid,COLOR_WHITE," cant teleport to you"); return 1; } new Float:X; new Float:Y; new Float:Z; GetPlayerPos(id,X,Y,Z); if(IsPlayerInAnyVehicle(playerid)) { SetVehiclePos(GetPlayerVehicleID(playerid),X+2,Y,Z); } else { SetPlayerPos(playerid,X,Y,Z+2.5); } return 1; } 



    מוסיפים הכי למטה:

    קוד PHP:
    strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } 


    הסוף..
    תהנו,
    קרדיט לפורום אחר
    נערך בפעם האחרונה על ידי CPD : 22/02/09 ב 21:28

  2. #2
    הסמל האישי של DjLove
    DjLove DjLove מנותק גורו
    תאריך הצטרפות
    29/10/08
    שם פרטי
    סתיו
    הודעות
    2,825
    קיבל לייק
    1 פעמים
    תודה אחי..

  3. #3
    הסמל האישי של Ha[M]us
    Ha[M]us Ha[M]us מנותק גורו
    תאריך הצטרפות
    13/01/09
    שם פרטי
    תמיר
    הודעות
    2,461
    קיבל לייק
    125 פעמים
    ציטוט במקור פורסם על ידי StavE צפה בהודעה
    תודה אחי..
    סתיו אתה לא הבנת אף מילה נכון? חחחח

    תודה אבל יש דרכים קצת יותר פשוטות וקצרות..

  4. #4
    הסמל האישי של DjLove
    DjLove DjLove מנותק גורו
    תאריך הצטרפות
    29/10/08
    שם פרטי
    סתיו
    הודעות
    2,825
    קיבל לייק
    1 פעמים
    XD חחח כן, זה סתם כדי להזיז קצת את העניינים פה שיגיבו יותר..
    [ + 1 ]

  5. #5
    Zachi_MeyeR Zachi_MeyeR מנותק ג'וניור
    תאריך הצטרפות
    17/04/08
    הודעות
    405
    קיבל לייק
    0 פעמים
    ציטוט במקור פורסם על ידי DarK_P[r]o צפה בהודעה
    זה מדריך קצר ולעניין אז מתחילים:
    למעלה עושים new חדש: .

    קוד PHP:
    [color=#007700]new admin[MAX_PLAYERS]; [/color]
    [color=#007700][color=#007700][/color][/color] 
    <FONT color=#007700>

    והגדרה:
    קוד PHP:
    [color=#007700][color=#ff8000][php]#define MAX_admin 1 
    [/color][/color][/php]
    קוד PHP:
    [color=#007700]כותבים למעלה בפבליק
     
    בפבליק: 
    [
    php]public OnPlayerConnect(playerid) 


    admin[playerid]=0;
    [/php]
    קוד PHP:
    [color=#0000bb][color=#007700]new name[MAX_PLAYER_NAME+1]; GetPlayerName(playerid, name, sizeof(name)); if(strcmp(name,"[Hyper]AAvivB",true) == 0) { admin[playerid]=1; return 1; }
    [color=#0000bb][color=#007700]<font color="#007700"><font color="#007700"><b>עכשיו יש שתי דרכים לעשות שתקבלו אדמין אתם יכולים לעשות אופציה כזאת בפבליק </b></font>
    <font color="#0000bb"><font color="#000000"><font color="#007700"><div class="bbcode_container">
        <
    div class="bbcode_description">קוד PHP:</div>
        <
    div class="bbcode_code" style="height:36px;"><code><code><span style="color: #000000">
    <
    span style="color: #0000BB"></span><span style="color: #007700">public&nbsp;</span><span style="color: #0000BB">OnPlayerConnect</span><span style="color: #007700">(</span><span style="color: #0000BB">playerid</span><span style="color: #007700">)&nbsp; </span><span style="color: #0000BB"></span>
    </
    span>
    </
    code></code></div>
    </
    div></font></font></font>
     
    </
    font><font color="#007700">
     
    </
    font> 
    קוד PHP:
    [color=#007700][php] 
    [/color]
    קוד PHP:
    [color=#007700][color=#007700]if(admin[playerid] == 0) { SendClientMessage(playerid,COLOR_GREY," text"); return 1; }  [/color]
    [color=#007700][color=#007700][/color]
    [color=#007700]וזה בעצם עושה שכל פעם ש Hyper AAvivB נכנס לשרת זה שם לו גישות או שאתם יכולים לעשות את זה עם פקודה מסוימת:[/color]
    [color=#007700] [/color]
    [color=#007700][php] 
    [/color]
    קוד PHP:
    [color=#007700][color=#007700]if(strcmp(cmdtext, "/command", true) == 0) { admin[playerid]=1; return 1; }[/color]
    [color=#007700][color=#007700][/color][/color][/color] 
    עכשיו אם אתה רוצה פקודה שתהיה רק לאדמין אתה מוספים לה את זה:


    [/color][/color][/php]

    דוגמא :

    if(strcmp(cmd,"/goto",true) == 0) { new tmp[256]; new id; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid,COLOR_GREY,"USAGE: /goto [id] "); return 1; } id = strval(tmp); if(!IsPlayerConnected(id)) { SendClientMessage(playerid,COLOR_WHITE,"invalid ID"); return 1; } if(admin[playerid] == 0) { SendClientMessage(playerid,COLOR_GREY,"you are not admin"); return 1; } if(id == playerid) { SendClientMessage(playerid,COLOR_WHITE," cant teleport to you"); return 1; } new Float:X; new Float:Y; new Float:Z; GetPlayerPos(id,X,Y,Z); if(IsPlayerInAnyVehicle(playerid)) { SetVehiclePos(GetPlayerVehicleID(playerid),X+2,Y,Z); } else { SetPlayerPos(playerid,X,Y,Z+2.5); } return 1; }

    [/php]
    קוד PHP:
    [color=#007700]
     
    מוסיפים הכי למטה: 

    [
    color=#007700]strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; }  
    [color=#007700]
    [color=#007700][/color][/color] 

    [/color][/color][/color][/color][/color][/color][/color]

    הסוף..
    תהנו,
    קרדיט לפורום אחר
    סדר את זה.
    אחרת ינעל!

  6. #6
    הסמל האישי של CPD
    CPD CPD מנותק טירון
    תאריך הצטרפות
    17/02/09
    הודעות
    72
    קיבל לייק
    0 פעמים
    סדרתי

+ הגב לנושא

תגובה מהירה תגובה מהירה

כתובת המייל לא תוצג בפורום.

נושאים דומים

  1. תגובות: 1
    הודעה אחרונה: 25/12/08, 18:06
  2. מדריך|לבנות בינדים לצ'אט צבעוני
    על ידי Dann11 בפורום Counter Strike 2
    תגובות: 1
    הודעה אחרונה: 23/06/08, 22:16
  3. מדריך | לבנות חדר
    על ידי DarkSoul בפורום Wolf Team
    תגובות: 4
    הודעה אחרונה: 01/10/07, 04:05
  4. [עזרה]צריך מדריך לבנות מכניק
    על ידי ofek12 בפורום Priston Tale
    תגובות: 11
    הודעה אחרונה: 30/07/06, 14:38
  5. [מדריך] לבנות שרת HTTP בכמה שניות.
    על ידי Totti* בפורום מדריכים וטיפים
    תגובות: 5
    הודעה אחרונה: 21/07/06, 20:51
eXTReMe Tracker