nos command help
#1

Код:
if(strcmp(cmdtext, "/nos", true) == 0)
{
	new vehicleid;
	AddVehicleComponent(vehicleid, 1010);
	AddVehicleComponent(vehicleid, 1013);
}
doesnt do anythiing when i type /nos
Reply
#2

pawn Код:
if(strcmp(cmdtext, "/nos", true) == 0)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    AddVehicleComponent(vehicleid, 1010);
    AddVehicleComponent(vehicleid, 1013);
}
Your version does nothing, because you haven't told the server what does "vehicleid" stand for. Now it's correct
Reply
#3

Quote:
Originally Posted by Kar
Код:
if(strcmp(cmdtext, "/nos", true) == 0)
{
	new vehicleid;
	AddVehicleComponent(vehicleid, 1010);
	AddVehicleComponent(vehicleid, 1013);
}
doesnt do anythiing when i type /nos
Quick PAWN tutorial:

When you do
Код:
new vehicleid;
It automaticly sets vehicle to 0. So, when you do
Код:
AddVehicleComponent(vehicleid, 1010);
the thing you do is
Код:
AddVehicleComponent(0, 1010);
So, if you do
Код:
new vehicleid = 1;
The vehicleid is set to 1, and therefore
Код:
AddVehicleComponent(vehicleid, 1010);
will be
Код:
AddVehicleComponent(1, 1010);
If you do
Код:
new vehicleid = GetPlayerVehicleID(playerid);
the vehicleid is set to whatever the vehicleid the player is in.
and when you do
Код:
AddVehicleComponent(vehicleid, 1010);
its
Код:
AddVehicleComponent([playersvehicleid], 1010);
and then it knows what vehicle it is.

You get it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)