teleport & carspawn
#1

i want do that but the pawno say this error
maps.pwn(329) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
maps.pwn(334) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
maps.pwn(690) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
maps.pwn(695) : warning 219: local variable "vehicleid" shadows a variable at a preceding level

on thop of the script
Код:
new vehicleid=0;
public OnPlayerCommandText(playerid, cmdtext[])
Код:
if (strcmp("/chocones", cmdtext, true, 10) == 0)
	{
		SetPlayerPos(playerid,-2059.9880,-211.7617,56.3695);
		ResetPlayerWeapons(playerid);
		SetPlayerInterior(playerid,0);
		new Float:X,Float:Y,Float:Z, Float:Angle;	GetPlayerPos(playerid, X,Y,Z);
		SendClientMessage(playerid,0x99ccff,"Mapa por [SOB]Chris");
		if (vehicleid==0)
		{
			vehicleid=CreateVehicle(539,X,Y,Z,Angle,6,0,-1);
			PutPlayerInVehicle(playerid,vehicleid,0);
		}
		else
		{
  			DestroyVehicle(vehicleid);
  			vehicleid=CreateVehicle(539,X,Y,Z,Angle,6,0,-1);
  			PutPlayerInVehicle(playerid,vehicleid,0);
 		}
		return 1;
	}
what supose do the script, teleport player to place spawn a car and put the player in the car, if a car already exist destroy the car and spawn a new.

=S im bad xD
Reply
#2

those are only warnings, delete all lines where you get warning and problem should be fixed
Reply
#3

Quote:
Originally Posted by ĸнelιғaтι
those are only warnings, delete all lines where you get warning and problem should be fixed
deleting is the worst he can do

just rename new vehicleid=0; to something else (example: new VehID=0)

the errors means you have more than 1 variables with the same name.
Reply
#4

Quote:
Originally Posted by ĸнelιғaтι
those are only warnings, delete all lines where you get warning and problem should be fixed
[me=kc]sighs...[/me]

In case you haven't guessed, [SOB]Chris please don't listen to ĸнelιғaтι.

The error is pretty self explanatory really, it means that you have defined 2 variables of the same name in overlapping scopes.

To fix it, you simply need to rename vehicleid in one of the instances.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)