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 )
if(strcmp(GetPlayerName(playerid), Name, true) == 0 )
Probaj tako stavit, nisam siguran al...
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?
Ako neko zna,neka pomogne. :)
if(strcmp(GetPlayerName(playername), Name, true) == 0 )
Mozda tako :D
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. :)
evo:
if(strcmp(GetPlayerName( i, PlayerName, sizeof(PlayerName) ), Name, true) == 0 )
i smanji PlayerName na [20]...
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.
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
Mozes mi je ti uradit?
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;
}
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 )
Vidis li da fali ";" prije te linije -.-
Dodao sam,ali error je isti.
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;
}