Making a goto cmd
#1

Removed
Reply
#2

Код HTML:
new
		index,
		cmd[20];
	cmd = strtok(cmdtext, index);
	if (strcmp(cmd, "/telebiz", true) == 0)
	{
		new
			tmp[20],
			id;
		tmp = strtok(cmdtext, index);
		if (strlen(tmp))
		{
			id = strval(tmp);
			if (IsPlayerConnected(id))
			{
				SetPlayerPos(playerid, BizInfo[id][PropX], BizInfo[id][PropY], BizInfo[id][PropZ]);
				SendClientMessage(id, 0x00FF00AA, "You have been teleported to your store");
				SendClientMessage(playerid, 0x00FF00AA, "Player teleported");
			}
			else
			{
				SendClientMessage(playerid, 0xFF0000AA, "Player not found");
			}
		}
		else
		{
			SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/telebiz <playerid>\"");
		}
		return 1;
	}
	return 0;
Reply
#3

Without loops and assuming you have your businesses saved by ID.
pawn Код:
CMD:telebiz(playerid, params[])
{
    new id;
    if(sscanf(params, "i", id)) return SendClientMessage(playerid, 0xFF0000FF, "SYNTAX: /Telebiz [id]");
    new string[100];
    format(string,sizeof(string),"/MyServerFiles/MyConfigFiles/MyBusinesses/%d.ini", id); //This should be the path of your businesses, is not necessary but it highly recommended in this situation.
    if(fexist(string)) //If the business ID exists
    {
        SetPlayerPos(playerid, BizInfo[id][PropX], BizInfo[id][PropY], BizInfo[id][PropZ]); //Obviously replace BizInfo with your own enum values etc.
        format(string,sizeof(string),"You have teleported to business ID: %d", id);
        SendClientMessage(playerid, 0xFFFF00FF, string);
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "This business doesn't exist, please try again.");
    return 1;
}
Reply
#4

Removed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)