string check dont work -
Headshot1108 - 16.03.2010
i like to check if the gang already the name, what the player like to create:
pawn Код:
if(strcmp(GangInfo[i][gangNames],tmp,true) == 0)
{
for(new i = 1; i < MAX_GANGS; i++)
{
SendClientMessage(playerid, rot, "This Gang already exists!");
return 1;
}
}
if i do this, i dont can create any gang.
But if i define the ID, it work:
pawn Код:
if(strcmp(GangInfo[0][gangNames],tmp,true) == 0)
{
SendClientMessage(playerid, rot, "This Gang already exists!");
return 1;
}
Re: string check dont work -
woot - 16.03.2010
pawn Код:
for(new i = 1; i < MAX_GANGS; i++)
{
if( strcmp( GangInfo[i][gangNames],tmp,true ) == 0) return SendClientMessage(playerid, rot, "This Gang already exists!");
}
Re: string check dont work -
Headshot1108 - 16.03.2010
Quote:
|
Originally Posted by //exora
pawn Код:
for(new i = 1; i < MAX_GANGS; i++) { if( strcmp( GangInfo[i][gangNames],tmp,true ) == 0) return SendClientMessage(playerid, rot, "This Gang already exists!"); }
|
same code, and don't work...
Re: string check dont work -
woot - 16.03.2010
No, you have to do the loop before checking the gangname, it shouldn't even compile the way you did.
Re: string check dont work -
Headshot1108 - 16.03.2010
Quote:
|
Originally Posted by //exora
No, you have to do the loop before checking the gangname, it shouldn't even compile the way you did.
|
lol, it work, and i tested ingame.
// Edit: ok, my bad, i've scriptet in this forum, i was to lazy to copy my snippet
my code in my script:
pawn Код:
for(new i = 1; i < MAX_GANGS; i++)
{
if(strcmp(GangInfo[i][gangNames],tmp,true)==0)
{
SendClientMessage(playerid, rot, "This Gang already exists!");
return 1;
}
}
and your code is the same

and these two doesn't work..
Re: string check dont work -
Headshot1108 - 16.03.2010
lol wtf?
solution?
i need it.
Re: string check dont work -
Jeffry - 16.03.2010
I would suggest that you make a
at your /gangcreate (or whatever the cmd is)
and check it with :
pawn Код:
if(GangCreated[i]==1) return SendClientMessage...
Helped?
Re: string check dont work -
Headshot1108 - 16.03.2010
i have it already, but the other players can create gangs with the same name, but also have a other gangid.
that i like to fix, that players dont can create gangs, what a gang already have. (the name)
with
pawn Код:
if(strcmp(GangInfo[0][gangNames],tmp,true) == 0)
{
SendClientMessage(playerid, rot, "This Gang already exists!");
return 1;
}
it work, but with the loop doesn't work? (The 0 is gangid 0)
Re: string check dont work -
Jeffry - 16.03.2010
Try:
pawn Код:
for(new i = 0; i < MAX_GANGS; i++)
{
if(strcmp(GangInfo[i][gangNames],tmp,true)==0)
{
SendClientMessage(playerid, rot, "This Gang already exists!");
return 1;
}
}
Btw, german?
Re: string check dont work -
Headshot1108 - 16.03.2010
Quote:
|
Originally Posted by Jeffry
Try:
pawn Код:
for(new i = 0; i < MAX_GANGS; i++) { if(strcmp(GangInfo[i][gangNames],tmp,true)==0) { SendClientMessage(playerid, rot, "This Gang already exists!"); return 1; } }
|
yes, that i have but doesn't work
Quote:
|
Originally Posted by Jeffry
Btw, german?
|
yes