/skydive choice
#1

I have a cmd that allows players to do /skydive, and it adds 1000 meters to their current location... Is it possible to make them be able to choose the meters? such as...

/skydive [amount of meters they want to go]

Is it possible? and can you show me?

Код:
if(!strcmp("/chuter",cmdtext,true))
  	{
                new Float:pPos[3];
	  	GivePlayerWeapon(playerid,46,1);
	  	GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
		SetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]+1000);
  		return 1;
	}
Reply
#2

pawn Код:
if(strcmp( cmd, "/skydive", true ) == 0 )
{
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
        SendClientMessage(playerid, COLOR_GREY, "USAGE: /skydive [metters]");
        return 1;
    }
    new metters;
    metters = strval(tmp);
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPlayerPos(playerid,X, Y, metters);
    GivePlayerWeapon(playerid,46,1);
    return 1;
}
Reply
#3

Quote:
Originally Posted by Amel_PAtomAXx
Посмотреть сообщение
pawn Код:
if(strcmp( cmd, "/skydive", true ) == 0 )
{
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
        SendClientMessage(playerid, COLOR_GREY, "USAGE: /skydive [metters]");
        return 1;
    }
    new input;
    input = strval(tmp);
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPlayerPos(playerid,X, Y, input);
    GivePlayerWeapon(playerid,46,1);
    return 1;
}
That failed to work...
Reply
#4

Quote:
Originally Posted by cray1100
Посмотреть сообщение
That failed to work...
I tried also, and It works fine for me.
Did you compiled successfully?
Reply
#5

pawn Код:
if(!strcmp(cmdtext, "/chuter", true, 7))
{
    if(!cmdtext[7]) // return usage: /chuter [amount of meters they want to go]
    new Float:zPos = floatstr(cmdtext[8]);
    if(!zPos) // return error: must be more than 0
    new Float:pPos[3];
    GivePlayerWeapon(playerid,46,1);
    GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
    SetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]+zPos);
    return 1;
}
Reply
#6

Quote:
Originally Posted by Amel_PAtomAXx
Посмотреть сообщение
I tried also, and It works fine for me.
Did you compiled successfully?
Yes, also it loaded fine, but ingame... When i use the /skydive command, it does nothing, it doesnt say the command isnt known... But it just dont do anything... all my other commands use the same includes actually, but it didnt qork
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)