One tier only - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: One tier only (
/showthread.php?tid=265010)
One tier only -
Tachibana - 29.06.2011
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;
}
Re: One tier only -
Shadoww5 - 29.06.2011
Put this instead of the array
dTires.
PHP код:
new dTires[5] = { 1, 2, 3, 8 };
Re: One tier only -
Tachibana - 29.06.2011
Quote:
Originally Posted by Shadoww5
Put this instead of the array dTires.
PHP код:
new dTires[5] = { 1, 2, 3, 8 };
|
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]);
Re: One tier only -
Shadoww5 - 29.06.2011
I said you have to delete this:
PHP код:
new dTires[5] =
{
1,
2,
3,
4,
5
};
And put this:
PHP код:
new dTires[5] = { 1, 2, 3, 8 };
Re: One tier only -
=WoR=Varth - 29.06.2011
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] = { 1, 2, 3, 8 };
|
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
Re: One tier only -
Shadoww5 - 29.06.2011
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
|
Beacuse if it is:
- 0 > All tires will be inflated.
- 3 > Right tires will be inflated, and left ones not.
Re: One tier only -
=WoR=Varth - 29.06.2011
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
|
Re: One tier only -
Shadoww5 - 29.06.2011
He just wants one tire popped.
So, do like I said.
I'm not understanding what you want to say.
Re: One tier only -
Tachibana - 29.06.2011
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;
}
Re: One tier only -
=WoR=Varth - 29.06.2011
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