Please, SA-MP community, if I could have a minute of your time.
#1

I need to make a command that uses a variable.

For instance /gotoworld (numberiwant) sends me to virtualworld (numberiwant)

Or, /skin (id I want) sets my skin to the ID I want.


The only way I know of to do this is to create a command for every single skin ID and every virtual world.
This would take years. There a shitload of virtual worlds.

Thanks for your time!
Reply
#2

What command system are you using? ZCMD? strcmp? YCMD?
With ZCMD and YCMD you'd have to use the params variable that each command has, with strcmp it's complicated.
Reply
#3

Oh, another example, I'm sure you're all familiar with NG-RP.

They do /buyclothes and then enter in the skin ID they want.

I actually haven't included a command system yet, is there not a way to do this with the default?

I have no problem using zcmd, but I'll have to rewrite a few codes. ^^
Reply
#4

You can use both strcmp and ZCMD at the same time, so that's not really a problem.
Reply
#5

Quote:
Originally Posted by BlackStrike
Посмотреть сообщение
You can use both strcmp and ZCMD at the same time, so that's not really a problem.
Oh! Okay, thanks.

Well, now I'm using YCMD.

How should I go about making a command called /goto that sends me to the virtual world that I type in?

Also, when I finish the server, you're all more than welcome to play on it.
I don't wanna reveal too much about it right now, but I promise it's nothing like you've ever seen and I promise I'm not 12.

I'm hosting it myself on my 100mbps connection.

Here's what I've gotten done so far.
Skipped spawn selection.
Custom loading screen.

No login/register system yet, I'ma be using mysql for that later.

If anyone wants to check it out, just to get a feel of what I'm talking about;
unfriendly.servebeer.com:7777
Reply
#6

https://sampwiki.blast.hk/wiki/SetPlayerVirtualWorld
Read there, they have an example too, pretty proper.
Reply
#7

Nah, I know how to do that.
But see, if you look in that code... it sets their virtual world to 3.
I want to set the virtual world to whatever I type /goto (anynumber)
Reply
#8

Try this:

pawn Код:
COMMAND:gotoworld(playerid, params[])
{
    if(isnull(params))
    {
        SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /world [number]");
    }
    if(strval(params) == 1)
    {
        SetPlayerVirtualWorld(playerid, 1);
        SendClientMessage(playerid, COLOR_GREEN, "You have gone to virtual world 1");
    }
    if(strval(params) == 2)
    {
        SetPlayerVirtualWorld(playerid, 2);
        SendClientMessage(playerid, COLOR_GREEN, "You have gone to virtual world 2");
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by sniperwars
Посмотреть сообщение
Try this:

pawn Код:
COMMAND:gotoworld(playerid, params[])
{
    if(isnull(params))
    {
        SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /world [number]");
    }
    if(strval(params) == 1)
    {
        SetPlayerVirtualWorld(playerid, 1);
        SendClientMessage(playerid, COLOR_GREEN, "You have gone to virtual world 1");
    }
    if(strval(params) == 2)
    {
        SetPlayerVirtualWorld(playerid, 2);
        SendClientMessage(playerid, COLOR_GREEN, "You have gone to virtual world 2");
    }
    return 1;
}
Are you kidding me? He want's any number..

This should do it:

pawn Код:
YCMD:setvw(playerid, params[])
{
    new ID, world;//You will need these new defines
    if(sscanf(params, "ui", ID, world)) return SendClientMessage(playerid, -1, "Command:/setvw [Playerid] [World]");//u stands for ID of players or playername, i stands for integer.
    SetPlayerVirtualWorld(ID, world);
    return 1;
}
Reply
#10

Will give you an example with zcmd and sscanf...

pawn Код:
CMD:setvw(playerid, params[])
{
    new id, vw;
    if(!sscanf(params, "ui", id, vw))
    {
        new string[128], Name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Name, sizeof(Name));
        GetPlayerName(id, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "You setted %s Virtual World to %d.", PlayerName, vw);
        SendClientMessage(playerid, 0xFFFFFFFF, string);
        format(string, sizeof(string), "Administrator %s setted your Virtual World to %d.", Name, vw);
        SendClientMessage(id, 0xFFFFFFFF, string);
        SetPlayerInterior(id, vw);
        return 1;
    }
    else return SendClientMessage(playerid, COLOR_DARKGOLD, "USAGE: /setvw [PlayerID/PartOfName] [Virtual World ID]");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)