09.02.2014, 14:21
You're missing some steps in your code.
You've created the variable 'currentveh', but you haven't actually assigned any value to it.
You haven't told the program that currentveh holds the data of your current vehicle. The code doesn't recognize names, you could have as well called it potato, it wouldn't have made any difference for the processing.
So, to actually make it hold the right value, let's turn it into this:
Now, what that extra line is doing, is that it tells your server to find out what the vehicle ID is from your vehicle. This is an unique ID for every vehicle in the entire server, used to identify them, kind of like a license plate.
Second, it tells the server to put that bit of information inside 'currentveh', so everytime currentveh is called, it's being redirected to that vehicle, that saves us from fetching the information every single time.
Now you can use currentveh to redirect to that specific vehicle, allowing you to do all sorts of things with it.
Hope this works, cheers!
You've created the variable 'currentveh', but you haven't actually assigned any value to it.
You haven't told the program that currentveh holds the data of your current vehicle. The code doesn't recognize names, you could have as well called it potato, it wouldn't have made any difference for the processing.
So, to actually make it hold the right value, let's turn it into this:
pawn Код:
new currentveh; // You had this one already
currentveh = GetPlayerVehicleID(playerid); // Here we go
{
// Your code
}
return 1;
Second, it tells the server to put that bit of information inside 'currentveh', so everytime currentveh is called, it's being redirected to that vehicle, that saves us from fetching the information every single time.
Now you can use currentveh to redirect to that specific vehicle, allowing you to do all sorts of things with it.
Hope this works, cheers!