PDA

View Full Version : Someone got a script on /gotoco(ordinates)?


JackieJ
23/02/2014, 07:17 PM
Someone got a script on /gotoco or /gotopos i really need that?

FilesMAker
23/02/2014, 07:20 PM
I'm working with strcmp do you want it ?

JackieJ
23/02/2014, 07:25 PM
Yes please message me on pm please :D

MattTucker
23/02/2014, 07:25 PM
CMD:gotoco(playerid, params[])
{
new int, Float:x, Float:y, Float:z;
// You can add your admin code here like "if(PlayerInfo[playerid][pAdmin]..."
if(sscanf(params, "fffi", x,y,z, int)) return SendClientMessage(playerid, -1, "USAGE: /gotoco [x] [y] [z] [interior]");
SetPlayerPos(playerid, x,y,z);
SetPlayerInterior(playerid, int);
return 1;
}
CMD:gotopos(playerid, params[])
{
return cmd_gotoco(playerid, params);
}

Here you go, both will work.

JackieJ
23/02/2014, 07:27 PM
THanks so much its working fine :)! ill give you +rep :D

LocMax
23/02/2014, 07:29 PM
Also a tip:

CMD:gotoco(playerid, params[])
{
new int, Float:x, Float:y, Float:z;
// You can add your admin code here like "if(PlayerInfo[playerid][pAdmin]..."
if(sscanf(params, "fffi", x,y,z, int)) return SendClientMessage(playerid, -1, "USAGE: /gotoco [x] [y] [z] [interior]");
SetPlayerPos(playerid, x,y,z);
SetPlayerInterior(playerid, int);
return 1;
}

If you're gonna add admin check, add it above
new int, Float:x, Float:y, Float:z;

so variables aren't created uselessly if player isn't admin.

like this:
CMD:gotoco(playerid, params[])
{
if(!IsPlayerAdmin) return SendClientMessage(playerid, 0xFF0000AA, "You need to be an admin to use this command.");
new int, Float:x, Float:y, Float:z;
if(sscanf(params, "fffi", x,y,z, int)) return SendClientMessage(playerid, -1, "USAGE: /gotoco [x] [y] [z] [interior]");
SetPlayerPos(playerid, x,y,z);
SetPlayerInterior(playerid, int);
return 1;
}

JackieJ
23/02/2014, 07:30 PM
Im tested it one time and when im tried to compile it again it gaves me errors :/.

C:\Users\JACOLA03\Desktop\cops and robbers\gamemodes\1.1.1.pwn(8706) : error 017: undefined symbol "PlayerInfo"
C:\Users\JACOLA03\Desktop\cops and robbers\gamemodes\1.1.1.pwn(8706) : warning 215: expression has no effect
C:\Users\JACOLA03\Desktop\cops and robbers\gamemodes\1.1.1.pwn(8706) : error 001: expected token: ";", but found "]"
C:\Users\JACOLA03\Desktop\cops and robbers\gamemodes\1.1.1.pwn(8706) : error 029: invalid expression, assumed zero
C:\Users\JACOLA03\Desktop\cops and robbers\gamemodes\1.1.1.pwn(8706) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

CMD:gotoco(playerid, params[])
{
new int, Float:x, Float:y, Float:z;
if(PlayerInfo[playerid][pAdmin]
if(sscanf(params, "fffi", x,y,z, int)) return SendClientMessage(playerid, -1, "USAGE: /gotoco [x] [y] [z] [interior]");
SetPlayerPos(playerid, x,y,z);
SetPlayerInterior(playerid, int);
return 1;
}

LocMax
23/02/2014, 07:31 PM
CMD:gotoco(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, 0xFF0000AA, "You need to be an admin to use this command.");
new int, Float:x, Float:y, Float:z;
if(sscanf(params, "fffi", x,y,z, int)) return SendClientMessage(playerid, -1, "USAGE: /gotoco [x] [y] [z] [interior]");
SetPlayerPos(playerid, x,y,z);
SetPlayerInterior(playerid, int);
return 1;
}

FilesMAker
23/02/2014, 07:33 PM
if (strcmp(cmd, "/gotoco", true) == 0 || strcmp(cmd, "/gotopos", true) == 0)
{
new tmp[128];
new Float:X, Float:Y, Float:Z;

tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return 0;
X = floatstr(tmp);

tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return 0;
Y = floatstr(tmp);

tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return 0;
Z = floatstr(tmp);

SetPlayerPos(playerid, X, Y, Z);
return 1;
}

JackieJ
23/02/2014, 07:33 PM
CMD:gotoco(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, 0xFF0000AA, "You need to be an admin to use this command.");
new int, Float:x, Float:y, Float:z;
if(sscanf(params, "fffi", x,y,z, int)) return SendClientMessage(playerid, -1, "USAGE: /gotoco [x] [y] [z] [interior]");
SetPlayerPos(playerid, x,y,z);
SetPlayerInterior(playerid, int);
return 1;
}


C:\Users\JACOLA03\Desktop\cops and robbers\gamemodes\1.1.1.pwn(8705) : error 017: undefined symbol "PlayerInfo"
C:\Users\JACOLA03\Desktop\cops and robbers\gamemodes\1.1.1.pwn(8705) : warning 215: expression has no effect
C:\Users\JACOLA03\Desktop\cops and robbers\gamemodes\1.1.1.pwn(8705) : error 001: expected token: ";", but found "]"
C:\Users\JACOLA03\Desktop\cops and robbers\gamemodes\1.1.1.pwn(8705) : error 029: invalid expression, assumed zero
C:\Users\JACOLA03\Desktop\cops and robbers\gamemodes\1.1.1.pwn(8705) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.


Dosent works :/

LocMax
23/02/2014, 07:36 PM
Do you have PlayerInfo enum?

Like:


enum PInfo
{
pAdmin
}
new PlayerInfo[MAX_PLAYERS][PInfo];

FilesMAker
23/02/2014, 07:50 PM
If my previous code works please +rep

LocMax
23/02/2014, 07:54 PM
If my previous code works please +rep

http://replygif.net/i/109.gif

FilesMAker
23/02/2014, 08:00 PM
Didn't work :D really I just make it !