31.01.2012, 16:20
Hey, I am working on my custom edit of the MMORGP gamemode my King Hual, and I wanted it to allow NPCs to spawn. Can you please tell me if this code is ok, or why it doesn't work?
Код:
public OnPlayerConnect(playerid) { if (IsPlayerNPC(playerid)) { SendClientMessageToAll(0x00000000,"An NPC connected!"); return 1; } Retries[playerid] = 0; logged_in[playerid] = 0; SendDeathMessage(INVALID_PLAYER_ID, playerid, 200); new pfile[100]; GetPlayerName(playerid, PName, sizeof(PName)); format(pfile, sizeof(pfile), "HAccounts/%s.ini",PName); if(!fexist(pfile)) { ShowPlayerDialog(playerid,101,DIALOG_STYLE_PASSWORD,"Registration","Please enter a password to register this account!","Register","Cancel"); } else { INI_ParseFile(pfile, "yini", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid,100,DIALOG_STYLE_PASSWORD,"Login","Please enter a password to login to this account!","Login","Cancel"); } #if defined UseProgBar bar[playerid] = CreateProgressBar(500.00, 5.00, 137.50, 15.19, ProgBarColor, 100.0); #endif ExpText[playerid] = TextDrawCreate(500.000000,3.000000,"_"); TextDrawAlignment(ExpText[playerid],0); TextDrawBackgroundColor(ExpText[playerid],0x000000ff); TextDrawFont(ExpText[playerid],1); TextDrawLetterSize(ExpText[playerid],0.399999,1.800000); TextDrawColor(ExpText[playerid],0xffff00ff); TextDrawSetOutline(ExpText[playerid],1); TextDrawSetProportional(ExpText[playerid],1); LevelText[playerid] = TextDrawCreate(546.000000,25.000000,"_"); TextDrawAlignment(LevelText[playerid],0); TextDrawBackgroundColor(LevelText[playerid],0x000000ff); TextDrawFont(LevelText[playerid],2); TextDrawLetterSize(LevelText[playerid],0.299999,1.400000); TextDrawColor(LevelText[playerid],0x00ff0099); TextDrawSetOutline(LevelText[playerid],1); TextDrawSetProportional(LevelText[playerid],1); TextDrawSetShadow(LevelText[playerid],1); HPBar[playerid] = CreateProgressBar(548.00, 68.2, 58.50, 5.50, -16776961, 100.0); HPText[playerid] = TextDrawCreate(556.500000,66.500000,"_"); TextDrawAlignment(HPText[playerid],0); TextDrawBackgroundColor(HPText[playerid],0x000000ff); TextDrawFont(HPText[playerid],3); TextDrawLetterSize(HPText[playerid],0.30,0.80); TextDrawColor(HPText[playerid],0xffffffff); TextDrawSetOutline(HPText[playerid],1); TextDrawSetProportional(HPText[playerid],1); TextDrawSetShadow(HPText[playerid],1); HP3DText[playerid] =Create3DTextLabel("_", -1, 0, 0, 0, 50, 0, 1); NameTag[playerid] = Create3DTextLabel(PName, 0xFFFFFFFF, 0,0,0, 50, 0, 1); LevelLabel[playerid] = Create3DTextLabel("_", TextLabelColor, 0, 0, 0, 50, 1); OpponentHPBar[playerid] = CreateProgressBar(234.00, 15.00, 184.50, 5.19, -16776961, 100.0); /*OpponentHPText[playerid] = TextDrawCreate(556.500000,66.500000,"100/100"); TextDrawAlignment(OpponentHPText[playerid],0); TextDrawBackgroundColor(OpponentHPText[playerid],0x000000ff); TextDrawFont(OpponentHPText[playerid],3); TextDrawLetterSize(OpponentHPText[playerid],0.30,0.80); TextDrawColor(OpponentHPText[playerid],0xffffffff); TextDrawSetOutline(OpponentHPText[playerid],1); TextDrawSetProportional(OpponentHPText[playerid],1); TextDrawSetShadow(HPText[OpponentHPText],1);*/ OpponentHPText[playerid] = TextDrawCreate(286.000000,12.900000,"_"); OpponentName[playerid] = TextDrawCreate(233.000000,2.000000,"_"); TextDrawAlignment(OpponentHPText[playerid],0); TextDrawAlignment(OpponentName[playerid],0); TextDrawBackgroundColor(OpponentHPText[playerid],0x000000ff); TextDrawBackgroundColor(OpponentName[playerid],0x000000ff); TextDrawFont(OpponentHPText[playerid],3); TextDrawLetterSize(OpponentHPText[playerid],0.599999,0.899999); TextDrawFont(OpponentName[playerid],1); TextDrawLetterSize(OpponentName[playerid],0.499999,0.899999); TextDrawColor(OpponentHPText[playerid],0xffffffff); TextDrawColor(OpponentName[playerid],0xff0000cc); TextDrawSetOutline(OpponentHPText[playerid],1); TextDrawSetOutline(OpponentName[playerid],1); TextDrawSetProportional(OpponentHPText[playerid],1); TextDrawSetProportional(OpponentName[playerid],1); TextDrawSetShadow(OpponentHPText[playerid],5); TextDrawSetShadow(OpponentName[playerid],1); return 1; }