[AJUDA] /sp e /ip -
DPS|NeW| - 14.05.2011
olб queria uma ajuda para fazer um comando que vocк digita /sp e sava o local aonde vocк estб, e /ip para ir ao local aonde vocк salvou.
pawn Код:
/sp //-----Salvar Posiзгo
/ip //------Ir Porsiзгo
isso deve funcionar sу com o player que digitou, e nгo por exemplo um player digita /sp e salva, os player do servidor que digitгo /ip e vai na posiзгo que o player que digitou salvou, ou seja cada player tem sua posiзгo salvada.
obrigado quem me ajudar.
Re: [AJUDA] /sp e /ip -
Shadoww5 - 14.05.2011
PHP код:
new Float:Lugar[3];
new xyz[MAX_PLAYERS];
new Int;
public OnPlayerConnect(playerid)
{
xyz[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
new idx;
new cmd[256];
new cmd = strtok(cmdtext,idx);
if(strcmp(cmd,"/sp",true))
{
Int = GetPlayerInterior(playerid);
GetPlayerPos(playerid,Lugar[0],Lugar[1],Lugar[2]);
SendClientMessage(playerid,0xFFF55CFF,"Coordenadas salvas. Digite /ip para ir atй o local marcado.");
xyz[playerid] = 1;
return 1;
}
if(strcmp(cmd,"/ip",true))
{
if(xyz[playerid] == 0) return SendClientMessage(playerid,0xFFF55CFF,"Nenhuma coordenada foi salva atй agora.");
SetPlayerInterior(playerid,Int);
SetPlayerPos(playerid,Lugar[0],Lugar[1],Lugar[2]);
if(IsPlayerInAnyVehicle(playerid))
{
new carid = GetPlayerVehicleID(playerid);
SetVehiclePos(carid,Lugar[0],Lugar[1],Lugar[2]);
LinkVehicleToInterior(carid, Int);
PutPlayerInVehicle(playerid,carid);
return 1;
}
SendClientMessage(playerid,0xFFF55CFF,"Vocк retornou ao local salvo.");
return 1;
}
return 0;
}
//CASO VOCК NГO TENHA strtok, ADICONE ISTO NO FINAL DO SEU GM:
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;
}
Re: [AJUDA] /sp e /ip -
Macintosh - 14.05.2011
pawn Код:
new Float:Shick[MAX_PLAYERS][3];
new Float:ShickPos[MAX_PLAYERS][6];
pawn Код:
if(strcmp("/sp", cmdtext, true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, Cor, "Vocк nгo й Administrador RCON!");
GetPlayerPos(playerid, Shick[playerid][0],Shick[playerid][1],Shick[playerid][2]);
SendClientMessage(playerid, COLOR_GRAD1, "Posiзгo Salvada (/ip)");
return 1;
}
pawn Код:
if(strcmp("/ip", cmdtext, true) == 0)
{
new pluto, mundinho;
pluto = ReturnUser(tmp);
mundinho = GetPlayerVirtualWorld(pluto);
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, Cor, "Vocк nгo й Administrador RCON!");
if(GetPlayerState(playerid) == 2)
{
new jipeshick = GetPlayerVehicleID(playerid);
SetVehiclePos(jipeshick, Shick[playerid][0],Shick[playerid][1],Shick[playerid][2]); LinkVehicleToInterior(jipeshick, 0);
ShickPos[playerid][0] = 0.0;
ShickPos[playerid][1] = 0.0;
}
else
{
SetPlayerPos(playerid, Shick[playerid][0],Shick[playerid][1],Shick[playerid][2]);
}
SetPlayerVirtualWorld(playerid, mundinho);
SendClientMessage(playerid, COLOR_GRAD1, "Teleportado para a posiзгo salvada no (/sp)!");
SetPlayerInterior(playerid,0);
return 1;
}
Re: [AJUDA] /sp e /ip -
DPS|NeW| - 14.05.2011
estranho diz que da erro. olha
Код:
C:\Users\Gabriel\Desktop\area2\sv\filterscripts\sp.pwn(99) : error 017: undefined symbol "Shick"
C:\Users\Gabriel\Desktop\area2\sv\filterscripts\sp.pwn(99) : warning 215: expression has no effect
C:\Users\Gabriel\Desktop\area2\sv\filterscripts\sp.pwn(99) : error 001: expected token: ";", but found "]"
C:\Users\Gabriel\Desktop\area2\sv\filterscripts\sp.pwn(99) : error 029: invalid expression, assumed zero
C:\Users\Gabriel\Desktop\area2\sv\filterscripts\sp.pwn(99) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
na linha 99 que й essa.
pawn Код:
GetPlayerPos(playerid, Shick[playerid][0],Shick[playerid][1],Shick[playerid][2]);
Re: [AJUDA] /sp e /ip -
Shadoww5 - 14.05.2011
Usa o codigo que eu postei. Garanto que funciona certinho =D
Re: [AJUDA] /sp e /ip -
DPS|NeW| - 14.05.2011
eu testei e da isso
Код:
C:\Users\Gabriel\Desktop\area2\sv\filterscripts\sp.pwn(65) : error 001: expected token: "#endif", but found "-end of file-"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
E esse й o fs.
pawn Код:
#include <a_samp>
#if defined FILTERSCRIPT
new Float:Lugar[3];
new xyz[MAX_PLAYERS];
new Int;
public OnPlayerConnect(playerid)
{
xyz[playerid] = 0;
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
new idx;
new cmd[256];
new cmd = strtok(cmdtext,idx);
if(strcmp(cmd,"/sp",true))
{
Int = GetPlayerInterior(playerid);
GetPlayerPos(playerid,Lugar[0],Lugar[1],Lugar[2]);
SendClientMessage(playerid,0xFFF55CFF,"Coordenadas salvas. Digite /ip para ir atй o local marcado.");
xyz[playerid] = 1;
return 1;
}
if(strcmp(cmd,"/ip",true))
{
if(xyz[playerid] == 0) return SendClientMessage(playerid,0xFFF55CFF,"Nenhuma coordenada foi salva atй agora.");
SetPlayerInterior(playerid,Int);
SetPlayerPos(playerid,Lugar[0],Lugar[1],Lugar[2]);
if(IsPlayerInAnyVehicle(playerid))
{
new carid = GetPlayerVehicleID(playerid);
SetVehiclePos(carid,Lugar[0],Lugar[1],Lugar[2]);
PutPlayerInVehicle(playerid,carid);
return 1;
}
SendClientMessage(playerid,0xFFF55CFF,"Vocк retornou ao local salvo.");
return 1;
}
return 0;
}
//CASO VOCК NГO TENHA strtok, ADICONE ISTO NO FINAL DO SEU GM:
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;
}
Re: [AJUDA] /sp e /ip -
Shadoww5 - 14.05.2011
Estб faltando o isto no final do filterscript:
Corrigi o meu codigo, entгo copia ele novamente. Ok ?
#EDIT
Funcionou ??
#OFF-TOPIC
Ai que emoзгo ! 500 posts no FORUM.SA-MP lol
Re: [AJUDA] /sp e /ip -
TiagoPS - 14.05.2011
Top
pawn Код:
new Float:Posicoes[MAX_PLAYERS][5];
Aqui
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/sp", cmdtext, true, 3) == 0)
{
if(!IsPlayerAdmin(playerid))
{
return SendClientMessage(playerid,0xffffff,"Seu Inъtil! Vocк Purum Acauso й Dimin lugado na errecom ???");
}
Posicoes[playerid][3] = GetPlayerInterior(playerid);
Posicoes[playerid][4] = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid,Posicoes[playerid][0],Posicoes[playerid][1],Posicoes[playerid][2]);
SendClientMessage(playerid,0xffffff,"Salvado com sucesso");
return 1;
}
if (strcmp("/ip", cmdtext, true, 3) == 0)
{
if(!IsPlayerAdmin(playerid))
{
return SendClientMessage(playerid,0xffffff,"Seu Inъtil! Vocк Purum Acauso й Dimin lugado na errecom ???");
}
SetPlayerPos(playerid,Posicoes[playerid][0],Posicoes[playerid][1],Posicoes[playerid][2]);
SetPlayerInterior(playerid, Posicoes[playerid][3]);
SetPlayerVirtualWorld(playerid, Posicoes[playerid][4]);
SendClientMessage(playerid,0xffffff,"Foi com sucesso");
return 1;
}
return 0;
}