SA-MP Forums Archive
Help plese. 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 plese. errors (/showthread.php?tid=151544)



Help plese. errors - bartje01 - 30.05.2010

Hey guys. I'm getting a phew erros

Код:
dcmd_setlspd(playerid, params[])
{
 if(PlayerInfo[playerid][LSPDLEVEL] >= 8)
  {
   new tmp[256], tmp2[256], Index;
   tmp = strtok(params,Index),
   tmp2 = strtok(params,Index);
   if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /setlspd [playerid] [level]");
   new player1, level, playername[MAX_PLAYER_NAME], string[128];
   player1 = strval(tmp);
   if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setlspd [playerid] [level]");
   level = strval(tmp2);
   GetPlayerName(player1,playername,sizeof(playername));

  format(string,sizeof(string),"You have made %s LSPD Level %d",playername,level);
  SendClientMessage(playerid,red,string);
	PlayerInfo[player1][LSPDLEVEL] = level;
	format(string,sizeof(string),"You are now LSPD rank %d",level);
	SendClientMessage(player1,red,string);
  }
  else SendClientMessage(playerid,red,"You are not a lspd CL or HL");
}
	else
	if(PlayerInfo[playerid][LSPDLEVEL] <= 0){
	SendClientMessage(player1,red,"This is not your member");

	return 1;
}
errors:
Код:
C:\Users\Bart\Desktop\SAMP FRESH LIFE\filterscripts\ladmin4v2.pwn(4821) : warning 209: function "dcmd_setlspd" should return a value
C:\Users\Bart\Desktop\SAMP FRESH LIFE\filterscripts\ladmin4v2.pwn(4822) : error 010: invalid function or declaration
C:\Users\Bart\Desktop\SAMP FRESH LIFE\filterscripts\ladmin4v2.pwn(4823) : error 010: invalid function or declaration
C:\Users\Bart\Desktop\SAMP FRESH LIFE\filterscripts\ladmin4v2.pwn(4826) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.



Re: Help plese. errors - Conroy - 30.05.2010

Check your IF statement, too many closing brackets.


Re: Help plese. errors - bartje01 - 30.05.2010

Well than can you fix it? XD
I tryed playing with those brackets for like 15 minutes
plz fix :P


Re: Help plese. errors - Conroy - 30.05.2010

pawn Код:
dcmd_setlspd(playerid, params[])
{
if(PlayerInfo[playerid][LSPDLEVEL] >= 8) {
new tmp[256], tmp2[256], Index;
   tmp = strtok(params,Index),
   tmp2 = strtok(params,Index);
   if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /setlspd [playerid] [level]");
   new player1, level, playername[MAX_PLAYER_NAME], string[128];
   player1 = strval(tmp);
   if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setlspd [playerid] [level]");
   level = strval(tmp2);
   GetPlayerName(player1,playername,sizeof(playername));
  format(string,sizeof(string),"You have made %s LSPD Level %d",playername,level);
  SendClientMessage(playerid,red,string);
    PlayerInfo[player1][LSPDLEVEL] = level;
    format(string,sizeof(string),"You are now LSPD rank %d",level);
    SendClientMessage(player1,red,string);
} else if(PlayerInfo[playerid][LSPDLEVEL] <= 7 && PlayerInfo[playerid][LSPDLEVEL] >= 1) { SendClientMessage(playerid,red,"You are not a lspd CL or HL"); } else
if(PlayerInfo[playerid][LSPDLEVEL] <= 0) { SendClientMessage(player1,red,"This is not your member"); }
return 1;
}
Fix the indentations.


Re: Help plese. errors - bartje01 - 30.05.2010

now why this?
Код:
C:\Users\Bart\Desktop\SAMP FRESH LIFE\filterscripts\ladmin4v2.pwn(4819) : error 017: undefined symbol "player1"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I have the player1 defined.
It worked earlier



now this code:
Код:
dcmd_setlspd(playerid, params[])
{
if(PlayerInfo[playerid][LSPDLEVEL] >= 8) {
new tmp[256], tmp2[256], Index;
   tmp = strtok(params,Index),
   tmp2 = strtok(params,Index);
   if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /setlspd [playerid] [level]");
   new player1, level, playername[MAX_PLAYER_NAME], string[128];
   player1 = strval(tmp);
   if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setlspd [playerid] [level]");
   level = strval(tmp2);
   GetPlayerName(player1,playername,sizeof(playername));
  format(string,sizeof(string),"You have made %s LSPD Level %d",playername,level);
  SendClientMessage(playerid,red,string);
	PlayerInfo[player1][LSPDLEVEL] = level;
	format(string,sizeof(string),"You are now LSPD rank %d",level);
	SendClientMessage(player1,red,string);
} else if(PlayerInfo[playerid][LSPDLEVEL] <= 7 && PlayerInfo[playerid][LSPDLEVEL] >= 1) { SendClientMessage(playerid,red,"You are not a lspd CL or HL"); } else

if(PlayerInfo[player1][LSPDLEVEL] <= 0) { SendClientMessage(playerid,red,"This is not your member"); }
return 1;
}



Re: Help plese. errors - Conroy - 30.05.2010

Dunno why you used player1, it should have been playerid, didn't notice it, I only copied and pasted your script. It works now though?


Re: Help plese. errors - bartje01 - 30.05.2010

well the player1 is the other player.


Re: Help plese. errors - Conroy - 30.05.2010

Yes, I know, I mean I don't know why you used player1 at the bottom, the message should be directed at playerid because it's an error message.


Re: Help plese. errors - bartje01 - 30.05.2010

ow well. Than how to fix thisXD
Do you have an idea?


Re: Help plese. errors - Conroy - 30.05.2010

You fixed it.. you replaced player1 with playerid.. there should be no errors.