[[[Ajuda]]] Ir a uma coordenada
#1

Olб pessoal, seria possivel eu digitar IN-GAME ?

/ir [coordenada x,y,z]

Eu nгo to falando de fazer um sistema de /irmorro ou /irls eu falo de /ir na coordenada que eu digitar na hora in-game
Reply
#2

pawn Код:
CMD:ir(playerid, params[])
{
    //if(!IsPlayerAdmin(playerid)) return 1;
    new Float:gPos[3];
    if(sscanf(params, "fff", gPos[0], gPos[1], gPos[2])) return SendClientMessage(playerid, -1, "Uso correto: /ir [x] [y] [z]");
    SetPlayerPos(playerid, gPos[0], gPos[1], gPos[2]);
    new gString[128];
    format(gString, sizeof(gString), "Vocк teleportou para a coordenada {00FF33}%f %f %f{FFFFFF}.", gPos[0], gPos[1], gPos[2]);
    SendClientMessage(playerid, -1, gString);
    return 1;
}
Reply
#3

pawn Код:
if(strcmp("/ircord", cmdtext, true) == 0)
{
     new Float:P[3];
     tmp = strtok(cmdtext, idx);
     if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
     P[0] = strval(tmp);
     if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
     P[1] = strval(tmp);
     if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
     P[2] = strval(tmp);
     SetPlayerPos(playerid, P[0], P[1], P[2]);
     format(aStr, sizeof(aStr), "Teleportado atй as cordenadas X » [%f] , Y » [%f] , Z » [%f]", P[0], P[1], P[2]);
     return 1;
}
@edit
Larceny ser emo kkkkk
Reply
#4

Quote:
Originally Posted by Allan Kardec
Посмотреть сообщение
pawn Код:
if(strcmp("/ircord", cmdtext, true) == 0)
{
     new Float:P[3];
     tmp = strtok(cmdtext, idx);
     if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
     P[0] = strval(tmp);
     if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
     P[1] = strval(tmp);
     if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
     P[2] = strval(tmp);
     SetPlayerPos(playerid, P[0], P[1], P[2]);
     format(aStr, sizeof(aStr), "Teleportado atй as cordenadas X » [%f] , Y » [%f] , Z » [%f]", P[0], P[1], P[2]);
     return 1;
}
@edit
Larceny ser emo kkkkk
C:\Users\Pedro\Desktop\LVC\GM\Com Infoorg\Las Venturas City\Las Venturas City\gamemodes\LasVenturas.pwn(39629) : error 017: undefined symbol "aStr"
C:\Users\Pedro\Desktop\LVC\GM\Com Infoorg\Las Venturas City\Las Venturas City\gamemodes\LasVenturas.pwn(39629) : error 017: undefined symbol "aStr"
C:\Users\Pedro\Desktop\LVC\GM\Com Infoorg\Las Venturas City\Las Venturas City\gamemodes\LasVenturas.pwn(39629) : error 029: invalid expression, assumed zero
C:\Users\Pedro\Desktop\LVC\GM\Com Infoorg\Las Venturas City\Las Venturas City\gamemodes\LasVenturas.pwn(39629) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.


Esqueci de dizer, sу adm pode usar^^

Linha:

pawn Код:
format(aStr, sizeof(aStr), "Teleportado atй as cordenadas X » [%f] , Y » [%f] , Z » [%f]", P[0], P[1], P[2]);
Reply
#5

Quote:
Originally Posted by Larceny
Посмотреть сообщение
pawn Код:
CMD:ir(playerid, params[])
{
    //if(!IsPlayerAdmin(playerid)) return 1;
    new Float:gPos[3];
    if(sscanf(params, "fff", gPos[0], gPos[1], gPos[2])) return SendClientMessage(playerid, -1, "Uso correto: /ir [x] [y] [z]");
    SetPlayerPos(playerid, gPos[0], gPos[1], gPos[2]);
    new gString[128];
    format(gString, sizeof(gString), "Vocк teleportou para a coordenada {00FF33}%f %f %f{FFFFFF}.", gPos[0], gPos[1], gPos[2]);
    SendClientMessage(playerid, -1, gString);
    return 1;
}
Eu nгo entendi o seu!!
Reply
#6

Ichigo, aconselho a vocк o uso de ZCMD/YCMD + sscanf, por alйm de ser mais flexнvel й muito mais rбpido.
Quote:
Originally Posted by Ichigo_Kurosaki
Посмотреть сообщение
Esqueci de dizer, sу adm pode usar^^
Se for usar o modo ZCMD+sscanf, apenas tire o comentбrio do meu comando.
Reply
#7

pawn Код:
if(strcmp("/ircord", cmdtext, true) == 0)
{
     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Somente administrador rcon pode usar!");
     new Float:P[3], aStr[75];
     tmp = strtok(cmdtext, idx);
     if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
     P[0] = strval(tmp);
     if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
     P[1] = strval(tmp);
     if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
     P[2] = strval(tmp);
     SetPlayerPos(playerid, P[0], P[1], P[2]);
     format(aStr, sizeof(aStr), "Teleportado atй as cordenadas X » [%f] , Y » [%f] , Z » [%f]", P[0], P[1], P[2]);
     return 1;
}
Reply
#8

Sem double post amigo, o Larceny usou ZCMD + SSCANF para dar velocidade ao code, e atй pela facilidade de usar zcmd, tanto que uso zcmd + sscanf.


edit: responderam primero q eu .
Reply
#9

Sim й bom usar zcmd, mas ele deve ter todos os comandos em strcmp.
Reply
#10

Para ultilizar o que faзo?

/ircoord 1529.6,-1691.2,13.3 ?


pawn Код:
if(strcmp("/ircoord", cmdtext, true) == 0)
    {
         if(!IsPlayerAdmin(playerid))
         return 1;
         SendClientMessage(playerid, -1, "Somente administrador rcon pode usar!");
         new Float:P[3], aStr[75];
         tmp = strtok(cmdtext, idx);
         if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
         P[0] = strval(tmp);
         if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
         P[1] = strval(tmp);
         if(!strlen(tmp)) return SendClientMessage(playerid, -1 , "/ircord [x] [y] [z]");
         P[2] = strval(tmp);
         SetPlayerPos(playerid, P[0], P[1], P[2]);
         format(aStr, sizeof(aStr), "Teleportado atй as cordenadas X » [%f] , Y » [%f] , Z » [%f]", P[0], P[1], P[2]);
         return 1;
    }
@edit

Meu gm nao tem comandos em zmd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)