Ok since Faheria is set in more of a modern day civilization, we are replacing the horses with cars that you can buy that last forever til you have to refill the fuel at a gas station. Anyways I dont think the NPC Server is supporting it, perhaps there is something wrong with this script that is not making it work online? Please help, thanks.
NPC Code:
if (created) {
message Car Key;
}
if (playertouchsme) {
toweapons Car Key;
setstring carfuel,100;
}
function HitCheck() {
for (this.p=1; this.p<playerscount; this.p++) {
if (abs((this.px)-(players[this.p].x+1.5))<=1 &&
abs((this.py)-(players[this.p].y+1.5))<=1.5){
hitplayer this.p,2,this.px,this.py;
}
}
}
if (weaponfired) {
disabledefmovement;
this.key4=0;
playerdir=2;
if (car1) {
setani INVsportscarin,;
}
if (suv1) {
setani INVsuvin,;
}
sleep .8;
this.fuel=strtofloat(#s(carfuel));
set caron;
timeout=.05;
}
if (caron) {
if (timeout) {
if (this.fuel>100) {
this.fuel=100;
}
this.key0=1;
this.key1=1;
this.key2=1;
this.key3=1;
if (car1) {
setani INVsportscar,;
}
if (suv1) {
setani INVsuv,;
}
if (this.skate=1.5) {
if (playerdir=0) {
this.px=playerx+1.5;
this.py=playery-2;
}
if (playerdir=1) {
this.px=playerx-2;
this.py=playery+1.5;
}
if (playerdir=2) {
this.px=playerx+1.5;
this.py=playery+5;
}
if (playerdir=3) {
this.px=playerx+5;
this.py=playery+1.5;
}
}
if (keydown(0)||keydown(1)||keydown(2)||keydown(3)) {
if (this.fueltime=0) {
this.fuel-=.05;
this.fueltime=8;
}
this.fueltime-=1;
if (this.skate<1.5) {
this.skate+=.05;
}
if (keydown(0)) {
if (onwall(playerx+1,playery-.5)||
onwall(playerx+2,playery-1.1)) {
this.key0=0;
}
}
if (keydown(2)) {
if (onwall(playerx+1,playery+3.5)||
onwall(playerx+2,playery+4.1)) {
this.key2=0;
}
}
if (keydown(1)) {
if (onwall(playerx-.5,playery+1)||
onwall(playerx-1.1,playery+2)) {
this.key1=0;
}
}
if (keydown(3)) {
if (onwall(playerx+3.5,playery+1)||
onwall(playerx+4.1,playery+2)) {
this.key3=0;
}
}
if (keydown(0)) {
if (this.key0=1) {
playery-=this.skate;
}
playerdir=0;
}
if (keydown(1)) {
if (this.key1=1) {
playerx-=this.skate;
}
playerdir=1;
}
if (keydown(2)) {
if (this.key2=1) {
playery+=this.skate;
}
playerdir=2;
}
if (keydown(3)) {
if (this.key3=1) {
playerx+=this.skate;
}
playerdir=3;
}
}
if (!keydown(0)&&!keydown(1)&&!keydown(2)&&!keydown(3 )) {
if (this.skate>0) {
this.skate-=.05;
}
if (playerdir=0) {
if (onwall(playerx+1,playery-.6)||
onwall(playerx+2,playery-1.1)) {
this.skate=0;
}
playery-=this.skate;
}
if (playerdir=1) {
if (onwall(playerx-.5,playery+1)||
onwall(playerx-1.1,playery+2)) {
this.skate=0;
}
playerx-=this.skate;
}
if (playerdir=2) {
if (onwall(playerx+1,playery+3.5)||
onwall(playerx+2,playery+4.1)) {
this.skate=0;
}
playery+=this.skate;
}
if (playerdir=3) {
if (onwall(playerx+3.5,playery+1)||
onwall(playerx+4.1,playery+2)) {
this.skate=0;
}
playerx+=this.skate;
}
}
HitCheck();
setstring carfuel,#v(this.fuel);
this.fuel=strtofloat(#s(carfuel));
showimg 555,sysfuel.gif,15,160;
showimg 556,carfuel.gif,17,170;
showimg 554,speedometer.gif,15+(this.skate*66),200;
changeimgpart 556,0,0,this.fuel+1,7;
changeimgvis 555,4;
changeimgvis 556,4;
changeimgvis 554,4;
if (this.fuel<=0) {
TurnOff();
}
if (playerhearts=0) {
TurnOff();
}
if (keydown(4)&&this.key4=1) {
TurnOff();
}
if (keydown(5)&&this.skate>.05) {
this.skate-=.1;
}
if (this.key4=0) {
this.key4wait+=.05;
if (this.key4wait=1) {
this.key4=1;
this.key4wait=0;
}
}
timeout=.05;
}
}
function TurnOff () {
hideimg 555;
hideimg 556;
hideimg 554;
playerdir=2;
if (car1) {
setani INVsportscarout,;
}
if (suv1) {
setani INVsuvout,;
}
unset caron;
freezeplayer .8;
enabledefmovement;
}
Yes I know it doesnt use arrays =\ but this is mainly a beta its just testing the movement and such.