All cars have nitrous? -
California_ - 14.01.2013
Hello? I was wondering how to make all cars have nitrous? I have over 100 of the "AddStaticVehicle"
and you know how the server says "SERVER: Unknown command." I seen in other servers.. they changed it. How?
Re: All cars have nitrous? -
Mr.Anonymous - 14.01.2013
Quote:
Originally Posted by California_
and you know how the server says "SERVER: Unknown command." I seen in other servers.. they changed it. How?
|
Use this. Edit however you need.
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success) SendClientMessage(playerid, -1, "Sorry but that command doesn't exsist!");
return 1;
}
Re: All cars have nitrous? -
[CG]Milito - 14.01.2013
Under OnGameModeInit
pawn Код:
for(new i=1; i<MAX_VEHICLES; i++)
{
AddVehicleComponent(i,1010);
}
Re: All cars have nitrous? -
anybox - 14.01.2013
If you want to do with command you should type this code
pawn Код:
if (!strcmp(cmdtext, "/nitro", true)) {
if (!IsPlayerInAnyVehicle(playerid)) return 1;
new vehicleid = GetPlayerVehicleID(playerid);
AddVehicleComponent(vehicleid, 1010); // X10 nitro
return 1;
}
But if you want to add nitro to the all vehicles you should write this in the end of
OnGameModeInit
pawn Код:
for (new i = 0; i < MAX_VEHICLES; i++)
AddVehicleComponent(i, 1010);
If you have a variable contains last vehicle id (for example, lastVehicleId) you can rewrite your loop as
for (new i = 0; i < lastVehicleId; i++)...
Re: All cars have nitrous? -
u3ber - 14.01.2013
@Mr.Anonymous: what becomes of when the command returns 0?
Re: All cars have nitrous? -
Mr.Anonymous - 14.01.2013
Quote:
Originally Posted by arbit
@Mr.Anonymous: what becomes of when the command returns 0?
|
Err.. "SERVER: Unknown command.".
Re: All cars have nitrous? -
u3ber - 14.01.2013
Quote:
Originally Posted by Mr.Anonymous
Err.. "SERVER: Unknown command.".
|
so because the command returns 0, does that means that it doesn't exist?
Re: All cars have nitrous? -
Mr.Anonymous - 14.01.2013
For example this command exist but returns 0 still works.
pawn Код:
CMD:nos(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
AddVehicleComponent(vehicleid, 1010);
return 0;
}
Re: All cars have nitrous? -
u3ber - 14.01.2013
@mr.anonymous: more like this,
pawn Код:
new bool:
myvar = false
;
YCMD:test(playerid, params[], help)
{
#pragma unused params
#pragma unused help
if(!myvar)
{
myvar = true;
return 0;
}
else
myvar = false;
SendClientMessage(playerid, -1, "true");
return 1;
}
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
if(!success)
SendClientMessage(playerid, -1, "command doesn't exist");
return 1;
}