Jump to content
  • 0

/goto (dcmd)


Rony

Question

Nick: Rony

Problema: Nu reusesc sa fac sa apara la cel care primeste /goto, un text.. De ex:. Eu dau /goto la Id 1.. Mie imi apare ca m-am teleportat la el..dar lui nu. Si as vrea sa apara  X (ID:) S-a teleportat la tine.

Erori / warnings: ..-..

Lini/script: Mai jos.

Ai incercat sa rezolvi singur ?: Da.. Am facut cumva..dar.. cand dadeam /goto, mie imi apareau amandoua texte.. (ca m-am teleportat..si ca s-a teleportat la mine. O-O)

Script (doar comanda dcmd.):

[pawn]

dcmd_goto(playerid,params[]) {

    if(PlayerInfo[playerid][Level] >= 1) {

  new player1, string[128];

if(!IsNumeric(params)) player1 = ReturnPlayerID(params);

else player1 = strval(params);

    if(gotoinfo[player1] == 0 && PlayerInfo[playerid][Level] < 12) return SendClientMessage(playerid, red, "{F81414}ERROR: {FFF1AF}Jucatorul a dezactivat comanda {F81414}GOTO! {00C0FF}(/goff).");

    if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /goto [playerid]");

if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) {

CMDMessageToAdmins(playerid,"GOTO");

new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(player1));

SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));

if(GetPlayerState(playerid) == 2) {

SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z); LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player1));

SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1));

} else SetPlayerPos(playerid,x+2,y,z);

format(string,sizeof(string),"{F3FF02}You have teleported to {F81414}\"%s\"", pName(player1));

return SendClientMessage(playerid,blue,string);

} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");

} else return SendClientMessage(playerid,red,"{F81414}ERROR:{FFFFFF} You are not a high enough level to use this command");

}

[/pawn]

Respect Khalifa ?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

pui un send client message cu player1 ex: SendClientMessage(player1, -1,"x s-a teleportat la tine");

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

Am tot incercat..Am adaugat aia.. dau compile..fara erori..

Pe joc, nu apare la player-ul respectiv cine s-a teleportat..

Am facut asta cu SendClient.. mai jos..intre linii.. si daca dai /goto..ia crash serverul. (si pe host..ia crash playerul)

Respect Khalifa ?

Link to comment
Share on other sites

[pawn]

D:\servere\rocom\gamemodes\rocom.pwn(62527) : warning 225: unreachable code

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Header size:          11928 bytes

Code size:          6471276 bytes

Data size:          3622352 bytes

Stack/heap size:    580000 bytes; estimated max. usage: unknown, due to recursion

Total requirements:10685556 bytes

1 Warning.

[/pawn]

62527:

[pawn]              format(string,sizeof(string),"{F81414}\"%s\" {F3FF02}has teleported to you.", pName(playerid));[/pawn]

EDIT!:

Am rezolvat.. Pentru cei ce vor sa stie cum..

[pawn]

              format(string,sizeof(string),"{F3FF02}You have teleported to {F81414}\"%s\"", pName(player1));

              return SendClientMessage(playerid,blue,string);

              format(string,sizeof(string),"{F81414}\"%s\" {F3FF02}s-a teleportat la tine.", pName(playerid));

              return SendClientMessage(player1,blue,string);

[/pawn]

Trebuie sters la primu' "return".. si lasat la al doilea.

[pawn]

              format(string,sizeof(string),"{F3FF02}You have teleported to {F81414}\"%s\"", pName(player1));

              SendClientMessage(playerid,blue,string);

              format(string,sizeof(string),"{F81414}\"%s\" {F3FF02}s-a teleportat la tine.", pName(playerid));

            return SendClientMessage(player1,blue,string);

[/pawn]

Deci:

[pawn]              format(string,sizeof(string),"{F3FF02}You have teleported to {F81414}\"%s\"", pName(player1));

              SendClientMessage(playerid,blue,string);

              format(string,sizeof(string),"{F81414}\"%s\" {F3FF02}s-a teleportat la tine.", pName(playerid));

            return SendClientMessage(player1,blue,string);

} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");

} else return SendClientMessage(playerid,red,"{F81414}ERROR:{FFFFFF} You are not a high enough level to use this command");

}

[/pawn]

Si restu' comenzii dinainte.. 

Respect Khalifa ?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.