#include <a_samp>
new name[MAX_PLAYER_NAME];
#define COLOR_RED 0xAA3333AA
public OnPlayerCommandText(playerid, cmdtext[])
{
new tmp[64], cmd[64], string[128];
new giveplayerid, idx;
cmd = strtok(cmdtext, idx), tmp = strtok(cmdtext, idx);
giveplayerid = strval(tmp);
if(strcmp(cmd, \"/goto\", true) == 0)
{
if(!strlen(tmp))
{
return SendClientMessage(playerid, COLOR_RED, \"Használat: /goto [playerid]\");
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, 0xFB0000FF, \"HIBA: Nem teleportálhatsz magadhoz!\");
} else {
if(IsPlayerConnected(giveplayerid))
{
GetPlayerName(giveplayerid, name, sizeof(name));
format(string, sizeof(string), \"Oda teleportáltál %s nevu játékoshoz!\", name);
SendClientMessage(playerid, COLOR_RED, string);
new Float:x, Float:y, Float:z;
GetPlayerPos(giveplayerid, x, y, z);
new cartype = GetPlayerVehicleID(playerid);
new State=GetPlayerState(playerid);
SetPlayerInterior(playerid,0);
{
if(State!=PLAYER_STATE_DRIVER)
{
SetPlayerPos(playerid,x+0.3, y, z);
}
else if(IsPlayerInVehicle(playerid, cartype) == 1)
{
SetVehiclePos(cartype,x+0.3, y, z);
SetVehicleZAngle(cartype,270);
}
else
{
SetPlayerPos(playerid,x+0.3, y, z);
}
}
} else {
SendClientMessage(playerid, 0xFB0000FF, \"Nincs ilyen játékos!\");
}
return 1;
}
}
return 0;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= \' \'))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > \' \') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Ez talán átláthatóbbá tenné...
stock Goto(playerid, toplayerid)
{
new Float:x[3];
GetPlayerPos(toplayerid,x[0],x[1],x[2]);
SetPlayerPos(playerid,x[0],x[1]-2.2,x[2]+0.5);
return 1;
}
if(strcmp(cmd, \"/goto\", true)
{
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
Goto(playerid, giveplayerid)
return 1;
}
stock Goto(playerid, toplayerid)
{
new Float:x[3];
GetPlayerPos(toplayerid,x[0],x[1],x[2]);
SetPlayerPos(playerid,x[0],x[1]-2.2,x[2]+0.5);
return 1;
}
Megírtam így semmi feltétellel.(Köszönet Gamestarnak a 2. feléért(megnem mondom, h hogy hívják :D))