error 008: must be a constant expression; assumed zero this one 3 times
new Float:CarParkX [1] =
{
{-2409.8438},//this line
{-2412.1250}
};
new Float:CarParkY [1] =
{
{1544.9453},//this line
{1544.9453}
};
new Float:CarParkZ [1] =
{
{7.0000},//this line
{17.0469}
};
: error 017: undefined symbol "CarParkX"
if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ])||(IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX, CarParkY, CarParkZ)))
new Float:CarParkZ [1] =
{
{7.0000},//this line
{17.0469}
};
new Float:CarParkZ [2] =
{
7.0000,
17.0469
};
new Float:CarParkX [1] [2]=
{
{-2409.8438},//this line
{-2412.1250}
};
new Float:CarParkY [1][2] =
{
{1544.9453},//this line
{1544.9453}
};
new Float:CarParkZ [1][2] =
{
{7.0000},//this line
{17.0469}
};
new /* variable name */ [ /* array*/] [ /* cells */];
new Float:CarParkX [2] = {
-2409.8438,
-2412.1250
};
new Float:CarParkY [2] = {
1544.9453,
1544.9453
};
new Float:CarParkZ [2] = {
7.0000,
17.0469
};
error 017: undefined symbol "CarParkX"
if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ])||(IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX, CarParkY, CarParkZ)))
pawn Код:
pawn Код:
|
if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ])||(IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[0], CarParkY[0], CarParkZ[0])) || (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[1], CarParkY[1], CarParkZ[1])))
whats the point of this? he dont need the array to be that big with that many dimensions.
on to the problem make sure the CaParkX , Y , Z defines are before that line of code. place them near the top of you file. also youll need to add what cell your using like CarParkX[0] or CarParkX[1] heres the completed code pawn Код:
regards, |
new Float:CarParkX [2] = {
-2409.8438, //cell [0]
-2412.1250 //cell [1]
};
new Float:CarParkX [3] = {
-2409.8438, //cell [0]
-2412.1250, //cell [1]
-2201.1250 //cell [2]
};
youll have to add to both the array and that last line i showed you
there is another way but a little more advanced. like a loop anyways pawn Код:
pawn Код:
new Float:CarParkX [3] = { -2409.8438, //cell [0] -2412.1250, //cell [1] -2201.1250 //cell [2] }; hope that clears it up. |
(IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[0], CarParkY[0], CarParkZ[0])) || (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[1], CarParkY[1], CarParkZ[1]
(IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX, CarParkY, CarParkZ))
new Float:CarParkX [6] = {
-2409.8438,
-2412.1250,
-2201.1250,//just add the car parks here only and not the line??
-2222.1584,
-5464.4464,
6465.6546
};
new iCarPark;
for(i=0;i<=6:i++){
if (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[i], CarParkY[i], CarParkZ[i])){
//player is in range code here.
break; //stop looping as you found what the player is near
}
}
yes using a loop
pawn Код:
im not sure how your code is suppose to work, so i just removed it to give you an example in the for loop notice the i<=6 this 6 should be replace with the number of array cells. hope this helps clear it up, if not tell me more on how you want it to function we can do the logic any way you like. regards, |
COMMAND:park(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:rot, vid, HouseID, Msg[128];
new engine,lights,alarm,doors,bonnet,boot,objective;
SendAdminText(playerid, "/park", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (GetPlayerVehicleSeat(playerid) == 0)
{
vid = GetPlayerVehicleID(playerid);
HouseID = AVehicleData[vid][BelongsToHouse];
if ((AVehicleData[vid][Owned] == true) && (HouseID != 0))
{
//here is the house ranges and car park ranges
if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ])||(IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[0], CarParkY[0], CarParkZ[0])) || (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[1], CarParkY[1], CarParkZ[1])))
{
GetVehiclePos(vid, x, y, z);
GetVehicleZAngle(vid, rot);
AVehicleData[vid][SpawnX] = x;
AVehicleData[vid][SpawnY] = y;
AVehicleData[vid][SpawnZ] = z;
AVehicleData[vid][SpawnRot] = rot;
for (new i; i < MAX_HOUSESPERPLAYER; i++)
{
HouseID = APlayerData[playerid][Houses][i];
for (new CarSlot; CarSlot < 10; CarSlot++)
{
if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid)
{
House_ReplaceVehicle(HouseID, CarSlot);
PutPlayerInVehicle(playerid, AHouseData[HouseID][VehicleIDs][CarSlot], 0);
GetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], 1, lights, alarm, doors, bonnet, boot, objective);
break;
}
}
}
SendClientMessage(playerid, 0x00FF00FF, "You've parked your vehicle");
PlayerFile_Save(playerid);
}
else
{
format(Msg, 128, "{FF0000}You need to be within %im of your house or carpark to park this vehicle", ParkRange);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
SendClientMessage(playerid, 0xFF0000FF, "You cannot park a vehicle that's not owned by you");
}
else
SendClientMessage(playerid, 0xFF0000FF, "You must be driving a vehicle you own to park it");
}
else
return 0;
return 1;
}
COMMAND:park(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:rot, vid, HouseID, Msg[128];
new engine,lights,alarm,doors,bonnet,boot,objective;
SendAdminText(playerid, "/park", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (GetPlayerVehicleSeat(playerid) == 0)
{
vid = GetPlayerVehicleID(playerid);
HouseID = AVehicleData[vid][BelongsToHouse];
if ((AVehicleData[vid][Owned] == true) && (HouseID != 0))
{
//here is the house ranges and car park ranges
if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
{
new iCarPark,bool:playerIsInParkRange;
for(i=0;i<=6:i++){
if (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[i], CarParkY[i], CarParkZ[i])){
//player is in range code here.
playerIsInParkRange = true
break; //stop looping as you found what the player is near
}
}
if(playerIsInParkRange) {
GetVehiclePos(vid, x, y, z);
GetVehicleZAngle(vid, rot);
AVehicleData[vid][SpawnX] = x;
AVehicleData[vid][SpawnY] = y;
AVehicleData[vid][SpawnZ] = z;
AVehicleData[vid][SpawnRot] = rot;
for (new i; i < MAX_HOUSESPERPLAYER; i++)
{
HouseID = APlayerData[playerid][Houses][i];
for (new CarSlot; CarSlot < 10; CarSlot++)
{
if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid)
{
House_ReplaceVehicle(HouseID, CarSlot);
PutPlayerInVehicle(playerid, AHouseData[HouseID][VehicleIDs][CarSlot], 0);
GetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], 1, lights, alarm, doors, bonnet, boot, objective);
break;
}
}
}
SendClientMessage(playerid, 0x00FF00FF, "You've parked your vehicle");
PlayerFile_Save(playerid);
} else {
format(Msg, 128, "{FF0000}You need to be within %im of your house or carpark to park this vehicle", ParkRange);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
{
format(Msg, 128, "{FF0000}You need to be within %im of your house or carpark to park this vehicle", ParkRange);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
SendClientMessage(playerid, 0xFF0000FF, "You cannot park a vehicle that's not owned by you");
}
else
SendClientMessage(playerid, 0xFF0000FF, "You must be driving a vehicle you own to park it");
}
else
return 0;
return 1;
}
hope this does it let me know
pawn Код:
get it working then maybe we can improve on how it works. |
C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PPC_PlayerCommands.inc(722) : error 017: undefined symbol "i" C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PPC_PlayerCommands.inc(722) : warning 205: redundant code: constant expression is zero C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PPC_PlayerCommands.inc(722) : error 017: undefined symbol "i" C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PPC_PlayerCommands.inc(722) : error 029: invalid expression, assumed zero C:\Program Files (x86)\Rockstar Games\samp\pawno\include\PPC_PlayerCommands.inc(722) : fatal error 107: too many error messages on one line
for(i=0;i<=6:i++){
for(new i=0;i<=6:i++){
sorry i missed this, if you didn't figure it out it should be
pawn Код:
|
(18) : error 001: expected token: ";", but found "break" (18) : warning 217: loose indentation (13) : warning 203: symbol is never used: "iCarPark"
COMMAND:park(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:rot, vid, HouseID, Msg[128];
new engine,lights,alarm,doors,bonnet,boot,objective;
SendAdminText(playerid, "/park", params);
if (APlayerData[playerid][LoggedIn] == true) {
if (GetPlayerVehicleSeat(playerid) == 0) {
vid = GetPlayerVehicleID(playerid);
HouseID = AVehicleData[vid][BelongsToHouse];
if ((AVehicleData[vid][Owned] == true) && (HouseID != 0)) {
if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ])) {
new iCarPark,bool:playerIsInParkRange;// the unsued iCarPark warning
for(new i=0;i<=6;i++) {
if (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[i], CarParkY[i], CarParkZ[i])) {
playerIsInParkRange = true
break; //and the other warning and error
}
}
if(playerIsInParkRange) {
GetVehiclePos(vid, x, y, z);
GetVehicleZAngle(vid, rot);
AVehicleData[vid][SpawnX] = x;
AVehicleData[vid][SpawnY] = y;
AVehicleData[vid][SpawnZ] = z;
AVehicleData[vid][SpawnRot] = rot;
for (new i; i < MAX_HOUSESPERPLAYER; i++) {
HouseID = APlayerData[playerid][Houses][i];
for (new CarSlot; CarSlot < 10; CarSlot++) {
if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid) {
House_ReplaceVehicle(HouseID, CarSlot);
PutPlayerInVehicle(playerid, AHouseData[HouseID][VehicleIDs][CarSlot], 0);
GetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], 1, lights, alarm, doors, bonnet, boot, objective);
break;
}
}
}
SendClientMessage(playerid, 0x00FF00FF, "You've parked your vehicle");
PlayerFile_Save(playerid);
}
else {
format(Msg, 128, "{FF0000}You need to be within %im of your house or carpark to park this vehicle", ParkRange);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else {
format(Msg, 128, "{FF0000}You need to be within %im of your house or carpark to park this vehicle", ParkRange);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
SendClientMessage(playerid, 0xFF0000FF, "You cannot park a vehicle that's not owned by you");
}
else
SendClientMessage(playerid, 0xFF0000FF, "You must be driving a vehicle you own to park it");
}
else
return 0;
return 1;
}
new bool:playerIsInParkRange;// removed iCarPark as its not used..
for(new i=0;i<=6;i++) {
if (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[i], CarParkY[i], CarParkZ[i])) {
playerIsInParkRange = true; // added a semi colon ;
break; //moved the break; statement back one tab to line up the indentation
}
}
COMMAND:park(playerid, params[])
{
new Float:x, Float:y, Float:z, Float:rot, vid, HouseID, Msg[128];
new engine,lights,alarm,doors,bonnet,boot,objective;
SendAdminText(playerid, "/park", params);
if (APlayerData[playerid][LoggedIn] == true) {
if (GetPlayerVehicleSeat(playerid) == 0) {
vid = GetPlayerVehicleID(playerid);
HouseID = AVehicleData[vid][BelongsToHouse];
if ((AVehicleData[vid][Owned] == true) && (HouseID != 0)) {
if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ])) {
new bool:playerIsInParkRange;// the unsued iCarPark warning
for(new i=0;i<=6;i++) {
if (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[i], CarParkY[i], CarParkZ[i])) {
playerIsInParkRange = true;
break; //and the other warning and error
}
}
if(playerIsInParkRange) {
GetVehiclePos(vid, x, y, z);
GetVehicleZAngle(vid, rot);
AVehicleData[vid][SpawnX] = x;
AVehicleData[vid][SpawnY] = y;
AVehicleData[vid][SpawnZ] = z;
AVehicleData[vid][SpawnRot] = rot;
for (new i = 0; i < MAX_HOUSESPERPLAYER; i++) {
HouseID = APlayerData[playerid][Houses][i];
for (new CarSlot; CarSlot < 10; CarSlot++) {
if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid) {
House_ReplaceVehicle(HouseID, CarSlot);
PutPlayerInVehicle(playerid, AHouseData[HouseID][VehicleIDs][CarSlot], 0);
GetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], 1, lights, alarm, doors, bonnet, boot, objective);
break;
}
}
}
SendClientMessage(playerid, 0x00FF00FF, "You've parked your vehicle");
PlayerFile_Save(playerid);
}
else {
format(Msg, 128, "{FF0000}You need to be within %im of your house or carpark to park this vehicle", ParkRange);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else {
format(Msg, 128, "{FF0000}You need to be within %im of your house or carpark to park this vehicle", ParkRange);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
}
else
SendClientMessage(playerid, 0xFF0000FF, "You cannot park a vehicle that's not owned by you");
}
else
SendClientMessage(playerid, 0xFF0000FF, "You must be driving a vehicle you own to park it");
}
else
return 0;
return 1;
}
if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ])) {
new bool:playerIsInParkRange;
for(new i=0;i<=6;i++) {
if (IsPlayerInRangeOfPoint(playerid, ParkRange, CarParkX[i], CarParkY[i], CarParkZ[i])) {
playerIsInParkRange = true;
break;
}
}
if(playerIsInParkRange) {
GetVehiclePos(vid, x, y, z);
GetVehicleZAngle(vid, rot);
AVehicleData[vid][SpawnX] = x;
AVehicleData[vid][SpawnY] = y;
AVehicleData[vid][SpawnZ] = z;
AVehicleData[vid][SpawnRot] = rot;
for (new i; i < MAX_HOUSESPERPLAYER; i++) {
HouseID = APlayerData[playerid][Houses][i];
for (new CarSlot; CarSlot < 10; CarSlot++) {
if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid) {
House_ReplaceVehicle(HouseID, CarSlot);
PutPlayerInVehicle(playerid, AHouseData[HouseID][VehicleIDs][CarSlot], 0);
GetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], 1, lights, alarm, doors, bonnet, boot, objective);
break;
}
}
}
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid) { new Float:hp; GetPlayerHealth(playerid,hp); new playerState = GetPlayerState(playerid); if(amount < 1 && weaponid == 50 && playerState == 1 && GetPlayerSpecialAction(playerid) == 0 && unspam[playerid] == 0) { SendClientMessage(playerid,0x33AA33AA,"[Anti-Carpark] - You have been unstuck!"); SetPlayerPos(playerid,X,Y,Z+3); SetPlayerHealth(playerid,hp+amount); unspam[playerid] = 5; } }
i just use
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid) { new Float:hp; GetPlayerHealth(playerid,hp); new playerState = GetPlayerState(playerid); if(amount < 1 && weaponid == 50 && playerState == 1 && GetPlayerSpecialAction(playerid) == 0 && unspam[playerid] == 0) { SendClientMessage(playerid,0x33AA33AA,"[Anti-Carpark] - You have been unstuck!"); SetPlayerPos(playerid,X,Y,Z+3); SetPlayerHealth(playerid,hp+amount); unspam[playerid] = 5; } } |
no, you can use that if you want, it works when someone is carparked, its automatic also, was just giving it out if you wanted to use it...
|