[Help] RemoveBuilding Errors
#1

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);
Reply
#2

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.
Reply
#3

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);
Reply
#4

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.
Reply
#5

Put that under OnPlayerConnect rather then playerid?
Reply
#6

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

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

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!
Reply
#8

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
Reply
#9

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.
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)