/fuelcars - 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)
+--- Thread: /fuelcars (
/showthread.php?tid=411781)
/fuelcars -
Akcent_Voltaj - 30.01.2013
i type /fuelcars and people dont get 100.0 do their cars..
PHP код:
if(strcmp(cmd, "/fuelcars", true) == 0)
{
new TD_String[25];
if(PlayerInfo[playerid][pAdmin] < 4) // when i did /fuelcars you had 99.9 and i had 100.0
{
SendClientMessage(playerid, COLOR_GREY, " You are not an Admin ! ");
return 1;
}
for(new i=1; i < MAX_VEHICLES; i++) //why?
{
new SecondFuel = VehicleFuel[i] % 10,
FirstFuel = (VehicleFuel[i] - SecondFuel) / 10;
VehicleFuel[i] = 1000;//what if you delete the textdrw here
format(TD_String, 25, "%i.%i", FirstFuel,SecondFuel);// so lets say i have 99.8 i do /fuelcars and its still 99.8
TextDrawSetString(Text:Values[playerid][3], TD_String); // was it i or playerid??before??
}
SendClientMessageToAll(COLOR_RED, "• Toate Masinile au fost umplute de combustibil! •"); // compile?yeah;0 now the command is smaller,i always use this methode
return 1;
}
Re: /fuelcars -
Roach_ - 30.01.2013
Try this:
pawn Код:
if(!strcmp(cmd, "/fuelcars", true))
{
new TD_String[25];
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, " You are not an Admin ! ");
for(new i=1; i < MAX_VEHICLES; i++) //why?
{
new SecondFuel[MAX_VEHICLES], FirstFuel[MAX_VEHICLES];
SecondFuel[i] = VehicleFuel[i] % 10;
FirstFuel[i] = (VehicleFuel[i] - SecondFuel[i]) / 10;
VehicleFuel[i] = 1000;//what if you delete the textdrw here
format(TD_String, 25, "%i.%i", FirstFuel,SecondFuel);// so lets say i have 99.8 i do /fuelcars and its still 99.8
TextDrawSetString(Text:Values[playerid][3], TD_String); // was it i or playerid??before??
}
SendClientMessageToAll(COLOR_RED, "• Toate Masinile au fost umplute de combustibil! •"); // compile?yeah;0 now the command is smaller,i always use this methode
return 1;
}
Re: /fuelcars -
Akcent_Voltaj - 30.01.2013
test the cmd..it doesent work..giving rep if you want!
Re: /fuelcars -
Threshold - 30.01.2013
pawn Код:
if(!strcmp(cmd, "/fuelcars", true))
{
new TD_String[25];
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, " You are not an Admin ! ");
for(new i = 1; i < MAX_VEHICLES; i++) //why?
{
new SecondFuel[MAX_VEHICLES], FirstFuel[MAX_VEHICLES];
SecondFuel[i] = VehicleFuel[i] % 10;
FirstFuel[i] = (VehicleFuel[i] - SecondFuel[i]) / 10;
VehicleFuel[i] = 1000;//what if you delete the textdrw here
format(TD_String, 25, "%i.%i", FirstFuel,SecondFuel);// so lets say i have 99.8 i do /fuelcars and its still 99.8
for(new p = 0; p < MAX_PLAYERS; p++)
{
if(IsPlayerConnected(p))
{
TextDrawSetString(Text:Values[playerid][3], TD_String); // was it i or playerid??before??
}
}
}
SendClientMessageToAll(COLOR_RED, "• Toate Masinile au fost umplute de combustibil! •"); // compile?yeah;0 now the command is smaller,i always use this methode
return 1;
}
Try this.
Re: /fuelcars -
Akcent_Voltaj - 31.01.2013
doesent work
![Sad](images/smilies/sad.gif)
(
Re: /fuelcars -
Threshold - 31.01.2013
Shit, my bad...
Change:
pawn Код:
TextDrawSetString(Text:Values[playerid][3], TD_String); // was it i or playerid??before??
To:
pawn Код:
TextDrawSetString(Text:Values[p][3], TD_String); // was it i or playerid??before??
Re: /fuelcars -
Akcent_Voltaj - 31.01.2013
no work..i get unknown command..
Re: /fuelcars -
Akcent_Voltaj - 31.01.2013
it doesent work..please help..REP optionally to who fixes it
![Cheesy](images/smilies/biggrin.png)
!
Re: /fuelcars -
Akcent_Voltaj - 31.01.2013
PHP код:
if(strcmp(cmd, "/fuelcars", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new TD_String[25];
if(PlayerInfo[playerid][pAdmin] >= 4)
{
for(new veh = 1; veh <MAX_VEHICLES;veh++)
{
new SecondFuel = VehicleFuel[veh] % 10,
FirstFuel = (VehicleFuel[veh] - SecondFuel) / 10;
VehicleFuel[veh] = 1000;
format(TD_String, 25, "%i.%i",FirstFuel,SecondFuel);
}
TextDrawSetString(Text:Values[playerid][3], TD_String);
SendClientMessage(playerid, COLOR_RED, "• Toate Masinile au fost umplute de combustibil! •");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not an Admin ! ");
return 1;
}
}
return 1;
}
Only the admin that types /fuelcars get 100.0 the other dont get ..why??please help....