SA-MP Forums Archive
Simple Jetpack Command Problem - 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: Simple Jetpack Command Problem (/showthread.php?tid=456793)



Simple Jetpack Command Problem - Zach7 - 07.08.2013

Hello, I am having a problem with my jetpack command, here is what it looks like.

pawn Код:
CMD:jetpack(playerid, params[])
{
    SetPlayerSpecialAction(playerid, 2);
    if(IsPlayerAdmin(playerid)) SendClientMessage(0xDEEE20FF, "Jetpack Spawned");
    else SendClientMessage(0xDEEE20FF, "You are not an admin.");
    return 1;
}
Does this look right?? I keep getting these errors

pawn Код:
C:\Users\Zach\Desktop\Critical Stunting\gamemodes\new.pwn(248) : error 035: argument type mismatch (argument 2)
C:\Users\Zach\Desktop\Critical Stunting\gamemodes\new.pwn(249) : error 035: argument type mismatch (argument 2)



Re: Simple Jetpack Command Problem - dominik523 - 07.08.2013

try this:
Код:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);



Re: Simple Jetpack Command Problem - Zach7 - 07.08.2013

Quote:
Originally Posted by dominik523
Посмотреть сообщение
try this:
Код:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
That's the same thing as "2"

I still get the same errors


Re: Simple Jetpack Command Problem - PT - 07.08.2013

pawn Код:
CMD:jetpack(playerid)
{
    if(IsPlayerAdmin(playerid))
    {
        SetPlayerSpecialAction(playerid, 2);
        SendClientMessage(playerid, 0xDEEE20FF, "Jetpack Spawned");
    }
    else SendClientMessage(playerid, 0xDEEE20FF, "You are not an admin.");
    return 1;
}



Re: Simple Jetpack Command Problem - PT - 07.08.2013

@ edit sorry the double post, my internet is crazy


Sorry..


Re: Simple Jetpack Command Problem - Zach7 - 07.08.2013

Rep +! You the man!


Re: Simple Jetpack Command Problem - PT - 07.08.2013

Quote:
Originally Posted by Zach7
Посмотреть сообщение
Rep +! You the man!
Thanks!


Re: Simple Jetpack Command Problem - Zach7 - 07.08.2013

Quote:
Originally Posted by PT
Посмотреть сообщение
Thanks!
I have another question, how can I simply make a /car command to spawn one certain vehicle ID at my location. I can't find a function for that.


Re: Simple Jetpack Command Problem - Konstantinos - 07.08.2013

Read me!


Re: Simple Jetpack Command Problem - Max5 - 07.08.2013

Quote:
Originally Posted by Zach7
Посмотреть сообщение
I have another question, how can I simply make a /car command to spawn one certain vehicle ID at my location. I can't find a function for that.
Alright if you want to spawn car and be saved in the server then use this.. [You can only delete it from the scriptfiles not IG]

http://www.mediafire.com/download/8s...6/vspawner.pwn

And if you want spawn one and /destroycar it then use those:

Код:
CMD:spawncar(playerid, params[]) {
	if (PlayerInfo[playerid][pAdmin] >= 4) {

		new
			iVehicle,
			iColors[2];

		if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1])) {
			SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /veh [model ID] [color 1] [color 2]");
		}
		else if(!(400 <= iVehicle <= 611)) {
			SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid model specified (model IDs start at 400, and end at 611).");
		}
		else if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) {
			SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid colour specified (IDs start at 0, and end at 255).");
		}
		else for(new iIterator; iIterator < sizeof(CreatedCars); iIterator++) if(CreatedCars[iIterator] == INVALID_VEHICLE_ID) {

			new
				Float: fVehPos[4];

			GetPlayerPos(playerid, fVehPos[0], fVehPos[1], fVehPos[2]);
			GetPlayerFacingAngle(playerid, fVehPos[3]);
			CreatedCars[iIterator] = CreateVehicle(iVehicle, fVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], -1);
			VehicleFuel[CreatedCars[iIterator]] = 100.0;
			LinkVehicleToInterior(CreatedCars[iIterator], GetPlayerInterior(playerid));
			return SendClientMessageEx(playerid, COLOR_GREY, "Vehicle spawned!");
		}
	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	return 1;
}
To destroy it:

Код:
CMD:destroycar(playerid, params[])
{
	new string[128];

	if(PlayerInfo[playerid][pAdmin] < 4)
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
		return 1;
	}
	new bool:breakingloop = false, newid = INVALID_VEHICLE_ID;
	if(IsPlayerInAnyVehicle(playerid))
	{
		for(new i=0;i<sizeof(CreatedCars);i++)
		{
			if(!breakingloop)
			{
				if(CreatedCars[i] == GetPlayerVehicleID(playerid)) // Checking for next available ID.
				{
					breakingloop = true;
					newid = i;
				}
			}
		}
		if(newid != INVALID_VEHICLE_ID)
		{
			new carid = GetPlayerVehicleID(playerid);
			DestroyVehicle(carid);
			CreatedCars[newid] = INVALID_VEHICLE_ID;
			format(string, sizeof(string), " Car %d destroyed.", carid);
			SendClientMessageEx(playerid, COLOR_GREY, string);
		}
	}
	return 1;
}