SA-MP Forums Archive
nos command help - 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: nos command help (/showthread.php?tid=153775)



nos command help - Kar - 10.06.2010

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


Re: nos command help - Jakku - 10.06.2010

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


Re: nos command help - Niixie - 10.06.2010

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?