• Welcome to Vice City Multiplayer.
 

Some RPG functions

Started by Robd, February 26, 2011, 12:10:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Robd

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;
}

Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

BIG[H]

Gooood any one need speed meter  in pawn msg me i am borred!
My Guru FORUM MUST VISITmegavcmp.freeforums.org

BIG[H] = BIG HaLL

yazeen

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

BIG[H]

Find n add
enum pInfo
{
engineon
}

:D then Compile
My Guru FORUM MUST VISITmegavcmp.freeforums.org

BIG[H] = BIG HaLL

Robd

lol, looks like i forgot a chunk of script
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

yazeen

Man wtf if u fogot what is the point of this upload!!!

Robd

I suck at releases, I always leave code out.
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

tato

Quote from: Robd on March 30, 2011, 03:11:00 AM
I suck at releases, I always leave code out.
mmmm but why bro ??





<!-- Facebook Badge START --><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" style="font-family: &quot;lucida grande&quot;,tahoma,verdana,arial,sans-serif; font-size: 11px; font-variant: normal; font-style: normal; font-weight: normal; color: #3B5998; text-decoration: none;" title="Eduardo Estrada">Eduardo Estrada</a><br/><a href="http://es-es.facebook.com/eduardoeslindo" target="_TOP" title="Eduardo Estrada"><img src="http://badge.facebook.com/badge/697470158.6069.1979465113.png" width="120" height="272" style="b

Robd

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)
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management