Making a goto cmd - 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: Making a goto cmd (
/showthread.php?tid=399000)
Making a goto cmd -
Fernado Samuel - 12.12.2012
Removed
Re : Making a goto cmd -
[HRD]Mar1 - 12.12.2012
Код 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;
Re: Making a goto cmd -
Threshold - 12.12.2012
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;
}
Re: Making a goto cmd -
Fernado Samuel - 12.12.2012
Removed