Balkan SA:MP

PAWN skriptanje, gamemodovi, filterskripte, include fajlovi, mape, pluginovi => Razgovor u vezi PAWN - skriptanja => Temu započeo: Partybreaker poslato Decembar 14, 2011, 21:42:14 POSLE PODNE

Naslov: [Pomoc] Komanda
Poruka od: Partybreaker poslato Decembar 14, 2011, 21:42:14 POSLE PODNE
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[128], string[ 128 ], Result = -1;
if( sscanf( params, "z", Name) )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /remoteuninvite [name]" );
SendClientMessage( playerid, RED, "NOTE: This command is CaSe SeNsItIvE." );
}
else
{
if (PlayerInfo[playerid][pLeader] >= 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[playerid][pMember] )
               {
                   if( dini_Int( string, "Rank" ) > PlayerInfo[playerid][pRank] )
                   {
                       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 )
Naslov: Odg: [Pomoc] Komanda
Poruka od: Voltage poslato Decembar 15, 2011, 00:38:57 PRE PODNE
if(strcmp(GetPlayerName(playerid), Name, true) == 0 )

Probaj tako stavit, nisam siguran al...
Naslov: Odg: [Pomoc] Komanda
Poruka od: ηυкℓєαяηαкσкι¢α.ιη¢ poslato Decembar 15, 2011, 00:43:48 PRE PODNE
Citat: Voltage poslato Decembar 15, 2011, 00:38:57 PRE PODNE
if(strcmp(GetPlayerName(playerid), Name, true) == 0 )

Probaj tako stavit, nisam siguran al...

Lol pa ne moze playerid kad je igrac tada offline?
Naslov: Odg: [Pomoc] Komanda
Poruka od: Partybreaker poslato Decembar 15, 2011, 02:03:01 PRE PODNE
Ako neko zna,neka pomogne. :)
Naslov: Odg: [Pomoc] Komanda
Poruka od: ||Will Rosee|| poslato Decembar 15, 2011, 22:25:03 POSLE PODNE
if(strcmp(GetPlayerName(playername), Name, true) == 0 )
Mozda tako :D
Naslov: Odg: [Pomoc] Komanda
Poruka od: Partybreaker poslato Decembar 16, 2011, 00:24:01 PRE PODNE
Citat: ||Will Rosee|| poslato Decembar 15, 2011, 22:25:03 POSLE PODNE
if(strcmp(GetPlayerName(playername), Name, true) == 0 )
Mozda tako :D

Nema potrebe da lupas. :)
Naslov: Odg: [Pomoc] Komanda
Poruka od: Zarathos poslato Decembar 16, 2011, 01:50:36 PRE PODNE
evo:

if(strcmp(GetPlayerName( i, PlayerName, sizeof(PlayerName) ), Name, true) == 0 )

i smanji PlayerName na [20]...
Naslov: Odg: [Pomoc] Komanda
Poruka od: Partybreaker poslato Decembar 16, 2011, 02:07:47 PRE PODNE
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.
Naslov: Odg: [Pomoc] Komanda
Poruka od: Zarathos poslato Decembar 16, 2011, 02:25:38 PRE PODNE
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
Naslov: Odg: [Pomoc] Komanda
Poruka od: Partybreaker poslato Decembar 16, 2011, 15:21:50 POSLE PODNE
Mozes mi je ti uradit?
Naslov: Odg: [Pomoc] Komanda
Poruka od: Zarathos poslato Decembar 16, 2011, 15:36:00 POSLE PODNE
Evo.

command(izbaci, playerid, params[])
{
new PlayerName[20], string[ 128 ], Result = -1, ime;
if( sscanf( params, "s[20]", ime) )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /remoteuninvite [name]" );
SendClientMessage( playerid, RED, "NOTE: This command is CaSe SeNsItIvE." );
}
else
{
if (PlayerInfo[playerid][pLeader] >= 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[playerid][pMember] )
                {
                    if( dini_Int( string, "Rank" ) > PlayerInfo[playerid][pRank] ) 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;
}
Naslov: Odg: [Pomoc] Komanda
Poruka od: Partybreaker poslato Decembar 16, 2011, 15:58:49 POSLE PODNE
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 )
Naslov: Odg: [Pomoc] Komanda
Poruka od: Zarathos poslato Decembar 16, 2011, 16:02:17 POSLE PODNE
Vidis li da fali ";" prije te linije -.-
Naslov: Odg: [Pomoc] Komanda
Poruka od: Partybreaker poslato Decembar 16, 2011, 16:04:14 POSLE PODNE
Dodao sam,ali error je isti.
Naslov: Odg: [Pomoc] Komanda
Poruka od: Zarathos poslato Decembar 16, 2011, 16:07:45 POSLE PODNE
Citat: Partybreaker poslato Decembar 16, 2011, 16:04:14 POSLE PODNE
Dodao sam,ali error je isti.
Evo sredio sam, zaboravio array xD

command(izbaci, playerid, params[])
{
new PlayerName[20], string[ 128 ], Result = -1, ime[20];
if( sscanf( params, "s[20]", ime) )
{
SendClientMessage( playerid, WHITE, "SYNTAX: /remoteuninvite [name]" );
SendClientMessage( playerid, RED, "NOTE: This command is CaSe SeNsItIvE." );
}
else
{
if (PlayerInfo[playerid][pLeader] >= 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[playerid][pMember] )
                {
                    if( dini_Int( string, "Rank" ) > PlayerInfo[playerid][pRank] ) 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;
}