SA-MP Forums Archive
Please, SA-MP community, if I could have a minute of your time. - 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: Please, SA-MP community, if I could have a minute of your time. (/showthread.php?tid=349952)



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

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!


Re: Please, SA-MP community, if I could have a minute of your time. - Dodo9655 - 10.06.2012

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.


- Unfriendly - 10.06.2012

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. ^^


Re: Please, SA-MP community, if I could have a minute of your time. - BlackStrike - 10.06.2012

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


BlackStrike - Unfriendly - 10.06.2012

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


Re: Please, SA-MP community, if I could have a minute of your time. - BlackStrike - 10.06.2012

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


Re: Please, SA-MP community, if I could have a minute of your time. - Unfriendly - 10.06.2012

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)


Re: Please, SA-MP community, if I could have a minute of your time. - sniperwars - 10.06.2012

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;
}



Re: Please, SA-MP community, if I could have a minute of your time. - JhnzRep - 10.06.2012

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;
}



Re : Please, SA-MP community, if I could have a minute of your time. - ricardo178 - 10.06.2012

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]");
}