SA-MP Forums Archive
[Help] RemoveBuilding 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)
+--- Thread: [Help] RemoveBuilding Errors (/showthread.php?tid=577952)



[Help] RemoveBuilding Errors - BigGreen - 15.06.2015

Hello there so i ran into some troubles with some mapping i never had this problem before
so when i compile it i get two Errors i tried it with another object like i deleted one building in the Map editor and i still get this

Код:
C:\Users\Splat\Desktop\script\gamemodes\RP.pwn(1124) : error 017: undefined symbol "playerid"
C:\Users\Splat\Desktop\script\gamemodes\RP.pwn(1125) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
and here is the example code

Код:
 RemoveBuildingForPlayer(playerid, 6479, 585.2813, -1456.7188, 45.8984, 0.25);
    RemoveBuildingForPlayer(playerid, 6371, 585.2813, -1456.7188, 45.8984, 0.25);



Re: [Help] RemoveBuilding Errors - Konstantinos - 15.06.2015

The same problem has been posted many times and nobody takes just a look in the samp wiki for an example usage: https://sampwiki.blast.hk/wiki/RemoveBuildingForPlayer

It also shows you the correct callback you need to call that function in.


Re: [Help] RemoveBuilding Errors - SoFahim - 15.06.2015

Use this type:

PHP код:
RemoveBuildings(playerid)
{
RemoveBuildingForPlayer(playerid6479585.2813, -1456.718845.89840.25);
RemoveBuildingForPlayer(playerid6371585.2813, -1456.718845.89840.25);

After this put this line in the GameModeInit

Код:
RemoveBuildings(playerid);



Re: [Help] RemoveBuilding Errors - J0sh... - 15.06.2015

Quote:
Originally Posted by SoFahim
Посмотреть сообщение
Use this type:

PHP код:
RemoveBuildings(playerid)
{
RemoveBuildingForPlayer(playerid6479585.2813, -1456.718845.89840.25);
RemoveBuildingForPlayer(playerid6371585.2813, -1456.718845.89840.25);

After this put this line in the GameModeInit

Код:
RemoveBuildings(playerid);
That.. wont help.

What is playerid? GameModeInit doesn't recognize playerid.


Re: [Help] RemoveBuilding Errors - Ritzy2K - 15.06.2015

Put that under OnPlayerConnect rather then playerid?


Re: [Help] RemoveBuilding Errors - BigGreen - 15.06.2015

Quote:
Originally Posted by Jamester
Посмотреть сообщение
That.. wont help.

What is playerid? GameModeInit doesn't recognize playerid.
So theres no fix??


Re: [Help] RemoveBuilding Errors - mamorunl - 15.06.2015

Quote:
Originally Posted by SoFahim
Посмотреть сообщение
Use this type:

PHP код:
RemoveBuildings(playerid)
{
RemoveBuildingForPlayer(playerid6479585.2813, -1456.718845.89840.25);
RemoveBuildingForPlayer(playerid6371585.2813, -1456.718845.89840.25);

After this put this line in the GameModeInit

Код:
RemoveBuildings(playerid);
OnGamemodeInit doesn't have a playerid variable!


Re: [Help] RemoveBuilding Errors - SoFahim - 15.06.2015

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
OnGamemodeInit doesn't have a playerid variable!
You can use anywhere in the
Код:
RemoveBuildingFromPlayer(playerid) 
 {
blah blah blah
}
After that You just need to add RemoveBuildingFromPlayer(playerid); in GameModeInit to remove the Objects.

I am working in this ststem. It works fine


Re: [Help] RemoveBuilding Errors - Vince - 15.06.2015

Quote:
Originally Posted by SoFahim
Посмотреть сообщение
After that You just need to add RemoveBuildingFromPlayer(playerid); in GameModeInit to remove the Objects.

I am working in this ststem. It works fine
Yeah, right. ಠ_ಠ
You probably did something silly like "new playerid". When OnGameModeInit is called there are no players connected hence you can't remove a building for a(ny) player at that point.


Re: [Help] RemoveBuilding Errors - Darkwood17 - 15.06.2015

Quote:
Originally Posted by Vince
Посмотреть сообщение
Quote:
Originally Posted by SoFahim
Посмотреть сообщение
You can use anywhere in the
Код:
RemoveBuildingFromPlayer(playerid) 
 {
blah blah blah
}
After that You just need to add RemoveBuildingFromPlayer(playerid); in GameModeInit to remove the Objects.

I am working in this ststem. It works fine
Yeah, right. ಠ_ಠ
You probably did something silly like "new playerid". When OnGameModeInit is called there are no players connected hence you can't remove a building for a(ny) player at that point.
As Vince said this won't work.
If you have "new playerid;" in OnGameModeInit and used RemoveBuildingForPlayer here you won't get any errors but this won't work in-game.
This function simply have to be added under OnPlayerConnect.
BigGreen may added his code under OnGameModeInit callback and that's the reason for getting this error.