One tier only
#1

Heyoh!

So here is a problem, I've got a random tier destroying (something like someone shot it) however I've got a function
pawn Код:
new rand = random(sizeof(gTires));
which chooses random tier HOWEVER it tokes more than one as I want only one to be taken off?

Here is the rest of the script

pawn Код:
SendClientMessage(playerid, COLOR_CRIMSON,"[WARNING]: One of your tires have gone flat!");
    UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid),0,0,0,dTires[rand]);
    return 1;
}
Reply
#2

Put this instead of the array dTires.

PHP код:
new dTires[5] = { 123}; 
Reply
#3

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
Put this instead of the array dTires.

PHP код:
new dTires[5] = { 123}; 
Hmm

Quote:

(61): warning 219: local variable "dTires" shadows a variable at a preceding level
(63): error 017: undefined symbol "rand"
(66) : warning 203: symbol is never used: "dTires"

So after adding
pawn Код:
new dTires[5] = { 1, 2, 3, 8 };
beside
pawn Код:
new rand = random(sizeof(gTires));
I gotta change
pawn Код:
UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid),0,0,0,dTires[rand]);
Reply
#4

I said you have to delete this:

PHP код:
new dTires[5] =
{
    
1,
    
2,
    
3,
    
4,
    
5
}; 
And put this:

PHP код:
new dTires[5] = { 123}; 
Reply
#5

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
I said you have to delete this:

PHP код:
new dTires[5] =
{
    
1,
    
2,
    
3,
    
4,
    
5
}; 
And put this:

PHP код:
new dTires[5] = { 123}; 
You mean
pawn Код:
new dTires[4] = { 1, 2, 3, 8 };

Anyway, why don't just
pawn Код:
UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid),0,0,0,random(5));
https://sampwiki.blast.hk/wiki/TireStates
Reply
#6

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
You mean
pawn Код:
new dTires[4] = { 1, 2, 3, 8 };
Sorry, it should be [4].

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
Anyway, why don't just
pawn Код:
UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid),0,0,0,random(5));
https://sampwiki.blast.hk/wiki/TireStates
Beacuse if it is:

- 0 > All tires will be inflated.
- 3 > Right tires will be inflated, and left ones not.
Reply
#7

Quote:

Beacuse if it is:

- 0 > All tires will be inflated.

https://sampwiki.blast.hk/wiki/TireStates


Quote:

- 3 > Right tires will be inflated, and left ones not.

Quote:

I want only one to be taken off

Reply
#8

He just wants one tire popped.

So, do like I said.

I'm not understanding what you want to say.
Reply
#9

Yea ONLY one tier to be taken off not two...

As well did what u guys told me and I get two errors now

pawn Код:
: warning 204: symbol is assigned a value that is never used: "rand"
(55 -- 60) : warning 203: symbol is never used: "dTires"
pawn Код:
KillTimer(tirestimer);
    new rand = random(sizeof(gTires));
    SendClientMessage(playerid, COLOR_CRIMSON,"[WARNING]: One of your tires have gone flat!");
    UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid),0,0,0,random(5));
    return 1;
}
Reply
#10

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
He just wants one tire popped.

So, do like I said.

I'm not understanding what you want to say.
pawn Код:
new dTires[4] = { 1, 2, 4, 8 };
EDIT: @tachibana just remove unused variable
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)