help with these errors - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help with these errors (
/showthread.php?tid=236892)
help with these errors -
THE_KNOWN - 08.03.2011
Код:
new tcp[MAX_PLAYERS][32];
for(new i=0;i<MAX_PLAYERS;i++)
{
new name[MAX_PLAYER_NAME];
if(GetPlayerName(i,name,sizeof(name))==tcp[playerid])//tcp has a players name stored
{
leader[i]=inputtext;//wrong input text valuse, i give three and its gives 51
break;
}
}
C:\Users\likith\Desktop\3c srvr\gamemodes\EeshRP.pwn(1841) : error 033: array must be indexed (variable "tcp")
C:\Users\likith\Desktop\3c srvr\gamemodes\EeshRP.pwn(1843) : error 006: must be assigned to an array
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Re: help with these errors -
Sascha - 08.03.2011
pawn Код:
new tcp[MAX_PLAYERS][32];
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
new name[MAX_PLAYER_NAME];
if(!strcmp(name, tcp[playerid], true))
{
leader[i] = inputtext);
break;
}
}
}
Re: help with these errors - rjjj - 08.03.2011
I did it
pawn Код:
new tcp[MAX_PLAYERS][32];
for(new i=0;i<MAX_PLAYERS;i++)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(i,name,sizeof(name));
if(strcmp(name,tcp[playerid],true)==0)//tcp has a players name stored
{
strmid(leader[i],inputtext,false,strlen(inputtext),128);
break;
}
}
I hope that i have helped
Re: help with these errors -
THE_KNOWN - 08.03.2011
can you tell me what strmid does?
Re: help with these errors -
THE_KNOWN - 08.03.2011
the inputtext is still not fixed. if i enter 3 it gives 51 , if i enter 5 it gives 61
Re: help with these errors -
Sasino97 - 08.03.2011
Quote:
pawn Код:
if(GetPlayerName(i,name,sizeof(name))==tcp[playerid])//
|
Strings can't be compared with "==" use strcmp(string1, string2, true) == 0/1/-1
Returns...
0: When they are equal
1: When the first is longer than the second
-1: When the second is longer than the first
Re: help with these errors -
THE_KNOWN - 08.03.2011
erm where do i put the endinput? the remaining prob is the inputtext value is wrong. if i enter 3 it gives me 51 for some reason -.-
Re: help with these errors -
Sasino97 - 08.03.2011
LOL ENDINPUT IS MY SIGNATURE... DONT PUT IT XD
Re: help with these errors -
THE_KNOWN - 08.03.2011
ops lol... but how do i solve the input bug -.-
Re: help with these errors -
Sascha - 08.03.2011
pawn Код:
new tcp[MAX_PLAYERS][32];
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
new name[MAX_PLAYER_NAME];
if(!strcmp(name, tcp[playerid], true))
{
leader[i] = strval(inputtext);
break;
}
}
}