Help Me !!!
#1

Hey guys i want to make send position command so that it sends my current position to another player in a checkpoint
and the command will be like this

/sendpos [ custompos / mypos ]
U will understand when you read this
Код:
CMD:sendpos(playerid, params[])
{
		new Float:x, Float:y, Float:z;
		new string[128];
		new int:sendto;
        if(PlayerInfo[playerid][pAdmin] > 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
		if(sscanf(params, "s[32]", params))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sendpos [option]");
			SendClientMessage(playerid, COLOR_GREY, "OPTIONS: mypos | custompos");
			return 1;
		}
		if(!strcmp(params, "mypos", true, 8))
		{
            //Give me code so that when i type '/sendpos mypos [playerid]' It Works
		}
		else if(!strcmp(params, "custompos", true, 5))
		{
			//Give me code so that when i type '/sendpos custompos [playerid] [x] [y] [z]' It Works
		}
		return 1;
}
Please Complete This Code --- I'm Beginner ---
Reply
#2

pawn Код:
CMD:sendpos(playerid, params[])
{
        new Float:x, Float:y, Float:z;
        new string[128];
        new int:sendto;
        if(PlayerInfo[playerid][pAdmin] > 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(sscanf(params, "s[32]", params))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sendpos [option]");
            SendClientMessage(playerid, COLOR_GREY, "OPTIONS: mypos | custompos");
            return 1;
        }
        if(!strcmp(params, "mypos", true, 8))
        {
            GetPlayerPos(playerid, x, y, z);
            SetPlayerCheckpoint(playerid, x, y, z, 3.0);
            //not tested
        }
        else if(!strcmp(params, "custompos", true, 5))
        {
            //Try this one you're self
        }
        return 1;
}
Try the rest your self since theres no learning from copying others work,
try the samp wiki...

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

Ok, but the problem is that strcmp params dont work just give me the code of strcmp

Or Give Me a Tut. on strcmp
Reply
#4

Just Fix This :

It Keeps Showing The USAGE Message

Код:
if(sscanf(params, "s[32]", params))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sendpos [option]");
            SendClientMessage(playerid, COLOR_GREY, "OPTIONS: mypos | custompos");
            return 1;
        }
        if(!strcmp(params, "mypos", true, 8))
        {

        }
        else if(!strcmp(params, "custompos", true, 5))
        {

        }
Reply
#5

pawn Код:
CMD:sendpos(playerid, params[])
{
        new Float:x, Float:y, Float:z;
        new string[128];
        new int:sendto;
        if(PlayerInfo[playerid][pAdmin] > 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
        if(sscanf(params, "s[32]", params))
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sendpos [option]");
            SendClientMessage(playerid, COLOR_GREY, "OPTIONS: mypos | custompos");
            return true;
        }
        else
        {
            if(!strcmp(params, "mypos", true, 8))
            {
                GetPlayerPos(playerid, x, y, z);
                SetPlayerCheckpoint(playerid, x, y, z, 3.0);
                //not tested
            }
            else if(!strcmp(params, "custompos", true, 5))
            {
                //Try this one you're self
            }
        }
        return true;
}
Reply
#6

Thanks, But Isn't There A Strcmp Tut..

Or Any Thing Which I Can Use To Get Information From Players In Commands
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)