#1

how would i set a cmd so if i said /nrg id get on a NRG bike..?

is it sommin alon the lines of

Код:
dcmd_abike(playerid,params[])
{
	#pragma unused params
	if(AccInfo[playerid][Level] >= 2)
	{
		if (!IsPlayerInAnyVehicle(playerid))
		{
			CarSpawner(playerid,522);
			SendCommandToAdmins(playerid,"ABike");
			return SendClientMessage(playerid,yellow,"|- Bike Successfully Created! -|");
		}
		else return SendClientMessage(playerid,red,"Error: You already have a vehicle");
	}
	else return ErrorMessages(playerid, 7);
}
Reply
#2

You wan't to be in this vehicle automaticly?

https://sampwiki.blast.hk/wiki/Function:PutPlayerInVehicle
Reply
#3

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
You wan't to be in this vehicle automaticly?

https://sampwiki.blast.hk/wiki/Function:PutPlayerInVehicle

yes, yes i do.
Reply
#4

would this work?

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/nrg", cmdtext, true, 10) == 0)
	{
 		PutPlayerInVehicle(playerid, vehicleid, 0);
    	return 1;
	}
	return 0;
}
Reply
#5

No. Save vehicle to variable:

pawn Код:
variable = CreateVehicle([...]);
and then use function but with variable parameter, no vehicleid.
pawn Код:
PutPlayerInVehicle(playerid, variable, 0);
Of course you can name your variable how you wan't. Vehicle, vehicleid, nrg and other. But function need to know to what vehicle you wan't put player.
Reply
#6

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/nrg", cmdtext, true, 10) == 0)
	{
	    variable = CreateVehicle([481]);
 		PutPlayerInVehicle(playerid, variable, 0);
    	return 1;
	}
	return 0;
}
Like that?? Im really new to this so i expect it will be wrong xD
Reply
#7

Okey so listen me now.

[...] - this mean other values for CreateVehicle function. Values for this function you can find here: https://sampwiki.blast.hk/wiki/CreateVehicle

to create variable you need to do this:
pawn Код:
new variable;
And then just in command set it just like you made it. But you need to put values into CreateVehicle.

pawn Код:
new variable;
variable = CreateVehicle(values function);
PutPlayerInVehicle(playerid, variable, 0);
Reply
#8

Ok i think thats a pretty basic cmd? But i think i have managed to mess it up once agian..


Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/nrg", cmdtext, true, 10) == 0)
	{
        	new variable;
		variable = CreateVehicle(481, 0.0, 0.0, 0.0, 2, 4, 0 );
		PutPlayerInVehicle(playerid, variable, 0);
    		return 1;
	}
	return 0;
}
Reply
#9

Код:
(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay)
Your model id is 481 - okey.
X, Y, Z - position where to create NRG.
Angle - rotation of the bike.
color1, color2 - colours of the vehicle.
respawn_delay - in what time vehicle will respawn after player exit it.

We need to get player position X, Y, Z and (optional) angle.

You need to create variables wich will save float.
pawn Код:
new Float:X, Float:Y, Float:Z, Float:Angle;
then use a function https://sampwiki.blast.hk/wiki/Function:GetPlayerPos to get X, Y, Z and https://sampwiki.blast.hk/wiki/GetPlayerFacingAngle to get player rotation (remember it's optional)

Then after you get position and rotation of player put variables X, Y, Z, Angle into values of CreateVehicle.
Reply
#10

urrm ya know what. Thats to complicated for me xD.

im gonna go download one that some has done already..
Reply
#11

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/nrg", cmdtext, true, 10) == 0)
    {
        new variable;
        new Float:X, Float:Y, Float:Z, Float:Angle;
        variable = CreateVehicle(481, X, Y, Z, Angle, 2, 4, -1); // -1 will never respawn.
        PutPlayerInVehicle(playerid, variable, 0);
        return 1;
    }
    return 0;
}
Am.. it's not complicated..
Reply
#12

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/nrg", cmdtext, true, 10) == 0)
{
new variable;
new Float:X, Float:Y, Float:Z, Float:Angle;
variable = CreateVehicle(481, X, Y, Z, Angle, 2, 4, -1); // -1 will never respawn.
PutPlayerInVehicle(playerid, variable, 0);
return 1;
}
return 0;
}

Cheers. God you make me feel so retarded xD
Reply
#13

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/nrg", cmdtext, true, 10) == 0)
    {
        new variable;
        new Float:X, Float:Y, Float:Z, Float:Angle;
        variable = CreateVehicle(481, X, Y, Z, Angle, 2, 4, -1); // -1 will never respawn.
        PutPlayerInVehicle(playerid, variable, 0);
        return 1;
    }
    return 0;
}
Am.. it's not complicated..
When i do it. it sends me under the map then to a random farm and if i keep doing it i can make a tall tower of NRGs, BMX... ?
Reply
#14

Add to CreateVehicle Z value this:
pawn Код:
Z+2.0
change just.
Reply
#15

Код HTML:
if (strcmp("/nrg", cmdtext, true, 10) == 0)
	{
		new variable;
        new Float:X, Float:Y, Float:Z, Float:Angle;
        variable = CreateVehicle(522, X, Y, Z, Angle, 2, 4, Z+2.0); // -1 will never respawn.
        PutPlayerInVehicle(playerid, variable, 0);
        return 1;
Like that?
Reply
#16

No. I said change Z this what you have now.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/nrg", cmdtext, true, 10) == 0)
    {
        new variable;
        new Float:X, Float:Y, Float:Z, Float:Angle;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, Angle);
        variable = CreateVehicle(481, X, Y, Z, Angle, 2, 4, -1); // -1 will never respawn.
        PutPlayerInVehicle(playerid, variable, 0);
        return 1;
    }
    return 0;
}
EPIC MY FAIL. I didn't add earlier GetPlayerPos and GetPlayerFacingAngle. This will now work for sure.
Reply
#17

^^ i hope
Reply
#18

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
No. I said change Z this what you have now.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/nrg", cmdtext, true, 10) == 0)
    {
        new variable;
        new Float:X, Float:Y, Float:Z, Float:Angle;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, Angle);
        variable = CreateVehicle(481, X, Y, Z, Angle, 2, 4, -1); // -1 will never respawn.
        PutPlayerInVehicle(playerid, variable, 0);
        return 1;
    }
    return 0;
}
EPIC MY FAIL. I didn't add earlier GetPlayerPos and GetPlayerFacingAngle. This will now work for sure.
Cheers, works perfectly.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)