need help!
#1

Hello, i am a scripting beginner and i am trying to make a roleplay script!

Now i just finished my some commands! like /me /s /b and the local chat!

But i get this error:

Код:
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(563) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(590) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(595) : warning 219: local variable "string" shadows a variable at a preceding level
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(623) : warning 219: local variable "string" shadows a variable at a preceding level
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(638) : warning 219: local variable "tmp" shadows a variable at a preceding level
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(640) : warning 219: local variable "playername" shadows a variable at a preceding level
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(675) : warning 219: local variable "playername" shadows a variable at a preceding level
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(703) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(707) : error 017: undefined symbol "gPlayerLogged"
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(707) : warning 215: expression has no effect
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(707) : error 001: expected token: ";", but found "]"
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(707) : error 029: invalid expression, assumed zero
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(707) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
And here is the script i am working on:

http://pastebin.com/m328e88a8

This is a begginer script that a guy posted on the fourms, so i want to edit it!

But i cant get the /me cmds and such to work!

plz help!

Reply
#2

Upload your script to www.pastebin.com if you want help.
Reply
#3

Updated! forgot there was pastebin lol
Reply
#4

Man because at the top of the script you have already did

new playername[MAX_PLAYER_NAME];

thats why you get that the playername shadows a local variable.

In your script you got logged = 1; at strcmp login

why dont you do

if(logged == 1)

I havent seen anywhere in your script like enum PlayerData { gPlayerLogged } new PlayerInfo[MAX_PLAYERS][PlayerData];

maybe this can help you..
Reply
#5

Ok, try and compile it with this. There will be some warnings about indentation because to be honest .. it's fucking horrible. But it should compile with no errors

http://pastebin.com/d12961aaa
Reply
#6

Add this:
new gPlayerLogged[MAX_PLAYERS];
replace this:
//----------------------------[ END OF ADMIN COMMANDS ]-------------------------
//----------------------------[ LOCK ]------------------------------------------
Код:
if (strcmp(cmdtext, "/lock", true)==0)
{
	if(IsPlayerInAnyVehicle(playerid))
	{
		new State=GetPlayerState(playerid);
		if(State!=PLAYER_STATE_DRIVER)
		{
			SendClientMessage(playerid,0xFF004040,"You can only lock the doors as the driver.");
			return 1;
		}
		new i;
		for(i=0;i<MAX_PLAYERS;i++)
		{
			if(i != playerid)
			{
				SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
			}
		}
		SendClientMessage(playerid, 0x33AA33AA, "Vehicle locked!");
		new Float:pX, Float:pY, Float:pZ;
		GetPlayerPos(playerid,pX,pY,pZ);
		PlayerPlaySound(playerid,1056,pX,pY,pZ);
	}
	else
	{
	SendClientMessage(playerid, 0xFF004040, "You're not in a vehicle!");
	}
return 1;
}
//----------------------------[ AFK ]------------------------------------------
if(strcmp(cmdtext, "/afk", true) == 0)
{
new string[256];
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,198.3797,160.8905,1003.0300);
SetPlayerFacingAngle(playerid,177.0350);
SetCameraBehindPlayer(playerid);
PlayerPlaySound(playerid,1082,198.3797,160.8905,1003.0300);
TogglePlayerControllable(playerid,0);
new away[MAX_PLAYER_NAME];
GetPlayerName(playerid, away, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s is away!", away);
SendClientMessageToAll(0xFF9933AA, string);
return 1;
}
to this:
Код:
//----------------------------[ END OF ADMIN COMMANDS ]-------------------------
//----------------------------[ LOCK ]------------------------------------------
	if (strcmp(cmdtext, "/lock", true)==0)
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			new State=GetPlayerState(playerid);
			if(State!=PLAYER_STATE_DRIVER)
			{
				SendClientMessage(playerid,0xFF004040,"You can only lock the doors as the driver.");
				return 1;
			}
			new i;
			for(i=0;i<MAX_PLAYERS;i++)
			{
				if(i != playerid)
				{
					SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
				}
			}
			SendClientMessage(playerid, 0x33AA33AA, "Vehicle locked!");
			new Float:pX, Float:pY, Float:pZ;
			GetPlayerPos(playerid,pX,pY,pZ);
			PlayerPlaySound(playerid,1056,pX,pY,pZ);
		}
		else
		{
			SendClientMessage(playerid, 0xFF004040, "You're not in a vehicle!");
		}
		return 1;
	}
//----------------------------[ AFK ]------------------------------------------
	if(strcmp(cmdtext, "/afk", true) == 0)
	{
		new string[256];
		SetPlayerInterior(playerid,3);
		SetPlayerPos(playerid,198.3797,160.8905,1003.0300);
		SetPlayerFacingAngle(playerid,177.0350);
		SetCameraBehindPlayer(playerid);
		PlayerPlaySound(playerid,1082,198.3797,160.8905,1003.0300);
		TogglePlayerControllable(playerid,0);
		new away[MAX_PLAYER_NAME];
		GetPlayerName(playerid, away, MAX_PLAYER_NAME);
		format(string, sizeof(string), "%s is away!", away);
		SendClientMessageToAll(0xFF9933AA, string);
		return 1;
	}
Clear 595(error line) line (Or define other named string variable) = "new string[256];"
Clear 623(error line) line (Or define other named string variable) = "new string[256];"
Clear 638(error line) line (Or define other named string variable) = "new tmp[256];"
Clear 640(error line) line (Or define other named string variable) = "new playername[MAX_PLAYER_NAME];"
Clear 675(error line) line (Or define other named string variable) = "new playername[MAX_PLAYER_NAME];"
703 - don't know, you have wierd command placements, you should get they all to normal
707 - should be already solved with defining "new gPlayerLogged[MAX_PLAYERS];"
AND I'm STILL POSTING THIS CAUSE HE NEEDS TO LEARN SOMETHING!
PS:You are Including a_samp 2 times...
Reply
#7

Quote:
Originally Posted by » ded «
Ok, try and compile it with this. There will be some warnings about indentation because to be honest .. it's fucking horrible. But it should compile with no errors

http://pastebin.com/d12961aaa
Quote:
Originally Posted by » ded «
Ok, try and compile it with this. There will be some warnings about indentation because to be honest .. it's fucking horrible. But it should compile with no errors

http://pastebin.com/d12961aaa
Uhm, didnt work!

Код:
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(162) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(177) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(180) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(194) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(196) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(204) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(214) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(216) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(217) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(282) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(284) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(304) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(322) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(324) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(325) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(329) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(334) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(344) : warning 217: loose indentation
BTW im a newbie, thats why it looks horrible
Reply
#8

Quote:
Originally Posted by RSX
703 - don't know, you have wierd command placements, you should get they all to normal
do it, or it will not disapear!
Reply
#9

Quote:
Originally Posted by st.anger
Quote:
Originally Posted by » ded «
Ok, try and compile it with this. There will be some warnings about indentation because to be honest .. it's fucking horrible. But it should compile with no errors

http://pastebin.com/d12961aaa
Quote:
Originally Posted by » ded «
Ok, try and compile it with this. There will be some warnings about indentation because to be honest .. it's fucking horrible. But it should compile with no errors

http://pastebin.com/d12961aaa
Uhm, didnt work!

Код:
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(162) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(177) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(180) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(194) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(196) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(204) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(214) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(216) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(217) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(282) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(284) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(304) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(322) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(324) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(325) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(329) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(334) : warning 217: loose indentation
G:\samp02Xserver.win32\gamemodes\AntonioRP.pwn(344) : warning 217: loose indentation
BTW im a newbie, thats why it looks horrible
it did work. You have no errors now only warnings. The indentation warnings can only be solved if you learn about indentation. Line all the code up the same, code shouldn't be all over the place.

See this: http://forum.sa-mp.com/index.php?topic=61893.0
Reply
#10

look if you do

Код:
dcmd_kick(playerid,params[])
{
   if(playerdata....etc)
   {
    // etc
   }
  return 1; // <==== here you loose indentation
}
like this

Код:
dcmd_kick(playerid,params[])
{
   if(playerdata....etc)
   {
    // etc
   }
   return 1;
}
place it exact under where your commands starts and you wont get any warnings.its not an error,just warning,it doesnt block your script to be compiled
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)