[Pomoc] Komanda

pre 14 godina
1,149
pregleda
15
postova
Partybreaker
Enforcer
pre 14 godina
Skripta koju koristim: CL
Detaljan opis problema: Nasao sam komandu da izbacim igraca dok nije online,prilagodio sam je koliko je bilo potrebno,ali samo me jedna stvar muci. Steka mi oko provjere imena igraca.
Dio skripte:
command(izbaci, playerid, params[])
{
new PlayerName, string[ 128 ], Result = -1;
if( sscanf( params, "z", Name) )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /remoteuninvite " );
SendClientMessage( playerid, RED, "NOTE: This command is CaSe SeNsItIvE." );
}
else
{
if (PlayerInfo >= 1)
{
   if(strlen(PlayerName) >= 1 && strlen(PlayerName) < MAX_PLAYER_NAME)
   {
       for(new i = 0; i < MAX_PLAYERS; i++)
       {
           if(IsPlayerConnected( i ) )
           {
               if(strcmp(GetPlayerName( i ), Name, true) == 0 )
               {
                   Result = i;
               }
           }
       }

       if( Result == -1 )
       {
       format( string, sizeof( string ), "Korisnici/%s.ini", Name );
       if( fexist( string ) )
       {
           if( dini_Isset( string, "Member" ) )
           {
               if( dini_Int( string, "Member" ) == PlayerInfo )
               {
                   if( dini_Int( string, "Rank" ) > PlayerInfo )
                   {
                       SendClientMessage( playerid, WHITE, "You can't uninvite a higher rank." );
                   }
                   else
                   {
                dini_IntSet( string, "Member", 0 );
                dini_IntSet( string, "Rank", 0 );
                format( string, sizeof( string ), "%s has left the group (remotely un-invited)", Name );
                SendFamilyMessage( playerid, WHITE, string);
                }
               }
               else
               {
                   SendClientMessage( playerid, WHITE, "That person isn't in the same group as you." );
               }
           }
           else
           {
               SendClientMessage( playerid, WHITE, "They are missing the player group variable." );
           }
       }
       else
       {
           SendClientMessage( playerid, WHITE, "Invalid name." );
       }
   }
   else
   {
       SendClientMessage( playerid, WHITE, "That player is connected, use /uninvite." );
   }
   }
   else
   {
       SendClientMessage( playerid, WHITE, "Invalid name." );
   }
}
else
{
   SendClientMessage( playerid, WHITE, "You're not a Group Leader." );
}
}
return 1;
}

Neke slike/video za lakse dobivanje pomoci(neobavezno):

Evo error:
C:\Documents and Settings\winxp\Desktop\CL gaming\Classic Life RolePlay\gamemodes\CLRP.pwn(25560) : warning 202: number of arguments does not match definition
C:\Documents and Settings\winxp\Desktop\CL gaming\Classic Life RolePlay\gamemodes\CLRP.pwn(25560) : warning 202: number of arguments does not match definition
C:\Documents and Settings\winxp\Desktop\CL gaming\Classic Life RolePlay\gamemodes\CLRP.pwn(25560) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

1 Error.


To je ova linija
if(strcmp(GetPlayerName( i ), Name, true) == 0 )
Voltage
Wheel Man
pre 14 godina
if(strcmp(GetPlayerName(playerid), Name, true) == 0 )


Probaj tako stavit, nisam siguran al...
NuklearnaKokica
Shot Caller
pre 14 godina
Voltage wrote on December 14, 2011, 11:38 pm:
if(strcmp(GetPlayerName(playerid), Name, true) == 0 )


Probaj tako stavit, nisam siguran al...


Lol pa ne moze playerid kad je igrac tada offline?
Partybreaker
Enforcer
pre 14 godina
Ako neko zna,neka pomogne. 🙂
||Will Rosee||
Hustler
pre 14 godina
if(strcmp(GetPlayerName(playername), Name, true) == 0 )

Mozda tako 😄
Partybreaker
Enforcer
pre 14 godina
||Will Rosee|| wrote on December 15, 2011, 9:25 pm:
if(strcmp(GetPlayerName(playername), Name, true) == 0 )

Mozda tako 😄


Nema potrebe da lupas. 🙂
| Pacino
Made Man
pre 14 godina
evo:
if(strcmp(GetPlayerName( i, PlayerName, sizeof(PlayerName) ), Name, true) == 0 )


i smanji PlayerName na ...
Partybreaker
Enforcer
pre 14 godina
Error:
C:\Documents and Settings\winxp\Desktop\CL gaming\Classic Life RolePlay\gamemodes\CLRP.pwn(25560) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

1 Error.


To je ova linija koju si mi ti dao da ubacim.
| Pacino
Made Man
pre 14 godina
A ja, ne mozes koristiti GetPlayerName funkciju unutar strcmpa, mora ici izvan, onda stavis ovako:
if(strcmp(PlayerName, Name, true) == 0 )


samo ne zaboravi GetPlayerName iznad gdje provjerava sa id-em
Partybreaker
Enforcer
pre 14 godina
Mozes mi je ti uradit?
| Pacino
Made Man
pre 14 godina
Evo.
command(izbaci, playerid, params[])
{
new PlayerName, string[ 128 ], Result = -1, ime;
if( sscanf( params, "s", ime) )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /remoteuninvite " );
SendClientMessage( playerid, RED, "NOTE: This command is CaSe SeNsItIvE." );
}
else
{
if (PlayerInfo >= 1)
{
    if(strlen(PlayerName) >= 1 && strlen(PlayerName) < MAX_PLAYER_NAME)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected( i ) )
            {
GetPlayerName( i, PlayerName, sizeof PlayerName )
                if(strcmp(PlayerName, ime, true) == 0 )
                    Result = i;
            }
        }

        if( Result == -1 )
        {
        format( string, sizeof( string ), "Korisnici/%s.ini", Name );
        if( fexist( string ) )
        {
            if( dini_Isset( string, "Member" ) )
            {
                if( dini_Int( string, "Member" ) == PlayerInfo )
                {
                    if( dini_Int( string, "Rank" ) > PlayerInfo ) return SendClientMessage( playerid, WHITE, "You can't uninvite a higher rank." );
                    else
                    {
                dini_IntSet( string, "Member", 0 );
                dini_IntSet( string, "Rank", 0 );
                format( string, sizeof( string ), "%s has left the group (remotely un-invited)", ime );
                SendFamilyMessage( playerid, WHITE, string);
                }
                }
                else return SendClientMessage( playerid, WHITE, "That person isn't in the same group as you." );
            }
            else return SendClientMessage( playerid, WHITE, "They are missing the player group variable." );
        }
        else return SendClientMessage( playerid, WHITE, "Invalid name." );
    }
    else return SendClientMessage( playerid, WHITE, "That player is connected, use /uninvite." );
    }
    else return SendClientMessage( playerid, WHITE, "Invalid name." );
}
else return SendClientMessage( playerid, WHITE, "You're not a Group Leader." );
}
return 1;
}
Partybreaker
Enforcer
pre 14 godina
Error:
C:\Documents and Settings\winxp\Desktop\CL gaming\Classic Life RolePlay\gamemodes\CLRP.pwn(25561) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

1 Error.


Linija:
if(strcmp(PlayerName, ime, true) == 0 )
| Pacino
Made Man
pre 14 godina
Vidis li da fali ";" prije te linije -.-
Partybreaker
Enforcer
pre 14 godina
Dodao sam,ali error je isti.
| Pacino
Made Man
pre 14 godina
Partybreaker wrote on December 16, 2011, 3:04 pm:
Dodao sam,ali error je isti.

Evo sredio sam, zaboravio array xD
command(izbaci, playerid, params[])
{
new PlayerName, string[ 128 ], Result = -1, ime;
if( sscanf( params, "s", ime) )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /remoteuninvite " );
SendClientMessage( playerid, RED, "NOTE: This command is CaSe SeNsItIvE." );
}
else
{
if (PlayerInfo >= 1)
{
    if(strlen(PlayerName) >= 1 && strlen(PlayerName) < MAX_PLAYER_NAME)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected( i ) )
            {
GetPlayerName( i, PlayerName, sizeof PlayerName )
                if(strcmp(PlayerName, ime, true) == 0 )
                    Result = i;
            }
        }

        if( Result == -1 )
        {
        format( string, sizeof( string ), "Korisnici/%s.ini", Name );
        if( fexist( string ) )
        {
            if( dini_Isset( string, "Member" ) )
            {
                if( dini_Int( string, "Member" ) == PlayerInfo )
                {
                    if( dini_Int( string, "Rank" ) > PlayerInfo ) return SendClientMessage( playerid, WHITE, "You can't uninvite a higher rank." );
                    else
                    {
                dini_IntSet( string, "Member", 0 );
                dini_IntSet( string, "Rank", 0 );
                format( string, sizeof( string ), "%s has left the group (remotely un-invited)", ime );
                SendFamilyMessage( playerid, WHITE, string);
                }
                }
                else return SendClientMessage( playerid, WHITE, "That person isn't in the same group as you." );
            }
            else return SendClientMessage( playerid, WHITE, "They are missing the player group variable." );
        }
        else return SendClientMessage( playerid, WHITE, "Invalid name." );
    }
    else return SendClientMessage( playerid, WHITE, "That player is connected, use /uninvite." );
    }
    else return SendClientMessage( playerid, WHITE, "Invalid name." );
}
else return SendClientMessage( playerid, WHITE, "You're not a Group Leader." );
}
return 1;
}

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava