This contains 2 RPG functions that are hard to come by.
-Fuel system
-Toggle Engine (yes there is a KillEngine in VCMP but it does not allow turning the engine back on, this does)
The first is relatively simple to insert, add the code somewhere near the bottom of the script and then use it as a function anywhere in the script.
public ToggleEngine(playerid,tmp)
{
new id;
id = GetPlayerVehicleID(playerid);
if(tmp == 0) {
KillVehicleEngine(id);
CarInfo[id][engineon] = 0;
}
else {
RemovePlayerFromVehicle(playerid);
PutPlayerInVehicle(playerid,id);
CarInfo[id][engineon] = 1;
}
return 1;
}
The next is a little more challenging as you have to add an array and several functions
This tutorial assumes you are using GUPS or GUPS based scripts
First:
We need to mae a new array(kinda like PlayerInfo, in GUPS)
Add this right under "enum sInfo"(where the definitions of variables end, not right below)
enum cInfo
{
gas
}
Then right below "new ServerInfo[1][sInfo];" put this
new CarInfo[here put the number of cars in your server][cInfo]
Now go to "OnGameModeInit"
put the following anywhere under LoadProps, or anything else in that area.
SetTimer("cargas",30000,true);
ok, now go somewhere near the bottom of your script(if you arent sure where just go to "stock HealAll"
public cargas()
{
for(new i = 0; i <= MAX_PLAYERS; i++) {
if(PlayerInfo[i][onfoot] == 0) CarInfo[157][locked] = 1;
else {
new id;
id = GetPlayerVehicleID(i);
new szMsg[256];
CarInfo[id][gas] = CarInfo[id][gas] -1;
format(szMsg,sizeof(szMsg),"~o~Fuel ~r~%d",CarInfo[id][gas]);
GameTextForPlayerBottom(i,szMsg);
if(CarInfo[id][gas] < 1) {
KillVehicleEngine(id);
CarInfo[id][gas] = 0;
}
}
}
}
Now we need to make cars without gas un-drivable.
Add the following in "OnPlayerEnterVehicle"
if(CarInfo[vehicleid][gas] < 1) {
ServerInfo[0][gas] = playerid;
SetTimer("engine",5000,false);
}
Now we just need to add the function in that timer
go to the same place you added "public cargas" and make a new function called "engine"
Make this code for the function
public engine()
{
new id;
SendClientMessage(ServerInfo[0][gas],COLOR_GREEN,"The engine dies, might want to check the fuel tank");
id = GetPlayerVehicleID(ServerInfo[0][gas]);
KillVehicleEngine(id);
ServerInfo[0][gas] = 100;
CarInfo[id][engineon] = 0;
return 1;
}
Gooood any one need speed meter in pawn msg me i am borred!
C:\Documents and Settings\yachu\Desktop\New Folder\RPGv1.1\gamemodes\RPG.pwn(4159) : error 017: undefined symbol "engineon"
C:\Documents and Settings\yachu\Desktop\New Folder\RPGv1.1\gamemodes\RPG.pwn(4164) : error 017: undefined symbol "engineon"
C:\Documents and Settings\yachu\Desktop\New Folder\RPGv1.1\gamemodes\RPG.pwn(4183) : error 017: undefined symbol "onfoot"
C:\Documents and Settings\yachu\Desktop\New Folder\RPGv1.1\gamemodes\RPG.pwn(4183) : error 032: array index out of bounds (variable "CarInfo")
C:\Documents and Settings\yachu\Desktop\New Folder\RPGv1.1\gamemodes\RPG.pwn(4202) : warning 213: tag mismatch
C:\Documents and Settings\yachu\Desktop\New Folder\RPGv1.1\gamemodes\RPG.pwn(4203) : warning 213: tag mismatch
C:\Documents and Settings\yachu\Desktop\New Folder\RPGv1.1\gamemodes\RPG.pwn(4205) : warning 213: tag mismatch
C:\Documents and Settings\yachu\Desktop\New Folder\RPGv1.1\gamemodes\RPG.pwn(4206) : error 017: undefined symbol "engineon"
C:\Documents and Settings\yachu\Desktop\New Folder\RPGv1.1\gamemodes\RPG.pwn(4225) : warning 203: symbol is never used: "PerformSQLquery"
C:\Documents and Settings\yachu\Desktop\New Folder\RPGv1.1\gamemodes\RPG.pwn(4225) : warning 203: symbol is never used: "PerformSQLquerySelect"
Pawn compiler 3.0.3367 Copyright (c) 1997-2005, ITB CompuPhase
5 Errors.
WTF what wrong i did i did correct as u said
Find n add
enum pInfo
{
engineon
}
:D then Compile
lol, looks like i forgot a chunk of script
Man wtf if u fogot what is the point of this upload!!!
I suck at releases, I always leave code out.
Quote from: Robd on March 30, 2011, 03:11:00 AM
I suck at releases, I always leave code out.
mmmm but why bro ??
Because I loe you and im trying real hard to make pwnage scripts (which I am good at) and im trying to release them (which I suck at)