15.12.2014, 20:32
Welp, I have tried it myself and I couldn't figure out a solution to the problem, I tried to solve it by myself but I just don't know how.
The code is clearly not working since I am getting run time error 4 (Array index out of bounds).
Code:
I am pretty sure this:
if(PR[vehicleid][Name] == PR[playerid][Name]) {
if(PR[vehicleid][UserID] == PR[playerid][UserID]) {
causes the problem because I am using vehicleid instead of something else.
I used that because I thought that'd be the way of figuering out of that vehicle is owned by a certain player.
The code is clearly not working since I am getting run time error 4 (Array index out of bounds).
Code:
pawn Код:
YCMD:v_park(playerid, params[], help) {
new query[500];
if(IsPlayerInAnyVehicle(playerid)) {
if(PR[playerid][VehiclesOwned] == 0) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] You don't even have a vehicle yet!");
else {
new vehicleid = GetPlayerVehicleID(playerid);
if(PR[vehicleid][Name] == PR[playerid][Name]) {
if(PR[vehicleid][UserID] == PR[playerid][UserID]) {
new Float:x, Float:y, Float:z, Float:angle;
GetVehicleZAngle(vehicleid, angle);
GetVehiclePos(vehicleid, x, y, z);
x = PR[playerid][parkX];
y = PR[playerid][parkY];
z = PR[playerid][parkZ];
angle = PR[playerid][Angle];
mysql_format(dbHandle, query, sizeof(query), "UPDATE `playerrelated` SET `parkX` = %f, `parkY` = %f, `parkZ` = %f, `Angle` = %f WHERE `Name` = '%s'", x, y, z, angle, GetName(playerid));
mysql_tquery(dbHandle, query);
DestroyVehicle(vehicleid);
} else {
return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] This isn't your vehicle! Therefore you can not park it!");
}
}
else {
return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] This isn't your vehicle! Therefore you can not park it!");
}
}
} else return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] You are not in any vehicle!");
return 1;
}
if(PR[vehicleid][Name] == PR[playerid][Name]) {
if(PR[vehicleid][UserID] == PR[playerid][UserID]) {
causes the problem because I am using vehicleid instead of something else.
I used that because I thought that'd be the way of figuering out of that vehicle is owned by a certain player.