2017-07-01 513 views
0

我想爲gta 5使用menya baes做一個小腳本,我想知道如果有人能幫助我。我目前遇到的問題是當我啓用godmode時,我無法關閉它。我意識到錯誤是遊戲等待我不成爲人,但是我找不到工作開關,因爲void SET_PLAYER_INVINCIBLE(Player player, BOOL toggle)在編譯時給我一個錯誤。反正感謝提前的幫助下,這裏是代碼gta 5腳本錯誤godmode

void Player() 

{ 
    // Initialise local variables here: 
    bool BoolOff = 0; bool BoolOn = 0; bool sample_invisible = 0; bool model_changer = 0; 


// Options' text here: 
AddTitle("Self Options"); 
AddLocal("Invincibility", GET_PLAYER_INVINCIBLE(PLAYER_ID()), BoolOn, BoolOff); 
AddLocal("Invisible", !IS_ENTITY_VISIBLE(PLAYER_PED_ID()), sample_invisible, sample_invisible); 
AddOption("Model Changer", model_changer); 




// Options' code here: 
if (BoolOn) 
{ 
    SET_PLAYER_INVINCIBLE(PLAYER_ID(), BOOL)toggle); 



    return; // Either use return; to exit to the switch if you don't have code below that you want executed. 
} 
if (sample_invisible) { 
    if (IS_ENTITY_VISIBLE(PLAYER_PED_ID())) SET_ENTITY_VISIBLE(PLAYER_PED_ID(), 0); 
    else SET_ENTITY_VISIBLE(PLAYER_PED_ID(), 1); 
    return; 
} 
+1

'SET_PLAYER_INVINCIBLE(PLAYER_ID(),BOOL)切換);'是不是有效的C++ ,除非出現一些非常奇怪的宏觀事件。 – cdhowie

回答

-2
bool GodBoolOn = 0; 
bool GodBoolOff = 0; 

AddLocal("God Mode", GET_PLAYER_INVINCIBLE(PLAYER_ID()), GodBoolOn, GodBoolOff); 


     if (GodBoolOn) 
    { 
     SET_ENTITY_INVINCIBLE(PLAYER_PED_ID(), TRUE); 
     return; 
    } 
    else if (GodBoolOff) 
    { 
     SET_ENTITY_INVINCIBLE(PLAYER_PED_ID(), FALSE); 
     return; 
    } 

沒問題的休息;)

+0

雖然此代碼片段可能會解決問題,但[包括解釋](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers)確實有助於提高帖子的質量。請記住,您將來會爲讀者回答問題,而這些人可能不知道您的代碼建議的原因。 –