Jump to content
  • 0

pomoc Používání IsPlayerAdmin()


SteveXtreme

Dotaz

Zdravím,

neví někdo, jak se má v kódu příkazu (v IFu) používat IsPlayerAdmin()? Kus kódu je asi takovýhle:

if (strcmp("/zivoty", cmdtext, true, 10) == 0) && IsPlayerAdmin(playerid) == true;
{
      SetPlayerArmour(playerid,100);
           SetPlayerHealth(playerid,100);
return 1;
 {

a chybové hlášení takovéhle:

C:\Users\SWAN\Desktop\5th Dimension Commands.pwn(72) : error 029: invalid expression, assumed zero
C:\Users\SWAN\Desktop\5th Dimension Commands.pwn(79) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Jsem začátečník, a nevím, v čem je chyba. Možná jsem tam do toho IsPlayerAdmin připletl trochu kódu z C#, ale nevím. Už celkem dlouho jsem neprogramoval v Pawnu....

Link to comment
Share on other sites

16 odpovědí na tuto otázku

Recommended Posts

  • 0

Teď mi compiler hází

C:\Users\SWAN\Desktop\5th Dimension Commands.pwn(72) : warning 213: tag mismatch
C:\Users\SWAN\Desktop\5th Dimension Commands.pwn(72) : error 036: empty statement
C:\Users\SWAN\Desktop\5th Dimension Commands.pwn(79) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Link to comment
Share on other sites

  • 0
  • Administrátor

 

Pokial niesom slepy, tak snad by to mohlo byt takto:

if ((strcmp("/zivoty", cmdtext, true, 10) == 0) && IsPlayerAdmin(playerid) == true);

Bez středníku jsou podmínky

Link to comment
Share on other sites

  • 0

aha ozaj, bodkociarka na konci. Dikes Ewwe, fakt som slepy.

Este tusim posledny riadok mas { zatvorku. Mal by si podmienku uzatvorit, } zatvorkou.

if ((strcmp("/zivoty", cmdtext, true, 10) == 0) && IsPlayerAdmin(playerid) == true)
{
SetPlayerArmour(playerid,100);
SetPlayerHealth(playerid,100);
return 1;
}
Link to comment
Share on other sites

  • 0
C:\Users\SWAN\Dropbox\5th Dimension Commands.pwn(72) : warning 217: loose indentation
C:\Users\SWAN\Dropbox\5th Dimension Commands.pwn(78) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.

Jsou to sice jenom warningy, ale i tak....

Link to comment
Share on other sites

  • 0

Tu je moje prekladanie: http://puu.sh/axO6x/aa1f11f839.png.

Tusim si nieco zle odtaboval, tam sa kvoli tomu pouziva zrejme

#pragma tabsize 0

Aj ked nemam na 100% pravdu, pri nespravnom odtabovani(medzeriach) mi to ajtak robi. Takze bud stiahni pwn co som poslal, alebo fixni pouzite tabulatory.

Link to comment
Share on other sites

  • 0
if (strcmp("/zivoty", cmdtext, true, 10) == 0) && IsPlayerAdmin(playerid) == true;
{
      SetPlayerArmour(playerid,100);
           SetPlayerHealth(playerid,100);
return 1;
 {

Unreachable code máš pretože máš return1; a potom máš otváraciu zátvorku, čo znamená, že by tam niečo malo byť, ale nikdy sa to nestane pretože return 1; ti ukončuje skript. #pragma tabsize je blbosť, používaj TAB na zarovnanie kódu aby si sa v ňom vedel vyznať.

if (!strcmp("/zivoty", cmdtext, true, 10) && IsPlayerAdmin(playerid))
{
    SetPlayerArmour(playerid,100);
    SetPlayerHealth(playerid,100);
    return 1;
}

je teda správne

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...