[Pedido] Conversao para zcmd
#1

gostei deste sistema de criaзao de veiculos porem queria que fosse em zcmd.
alguem poderia converter para mim ?

Comando :
pawn Код:
if(strcmp(cmd, "/car", true, 10) == 0)
    {

        new String[200];
        new tmp[256];
        new Float:x, Float:y, Float:z;

        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, l_red, "You diden't give a vehicle name");

        new vehicle = GetVehicleModelIDFromName(tmp);

        if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, l_red, "That vehicle name was not found");

        new Float:a;
        GetPlayerFacingAngle(playerid, a);
        GetPlayerPos(playerid, x, y, z);

        if(IsPlayerInAnyVehicle(playerid) == 1)
        {
            GetXYInFrontOfPlayer(playerid, x, y, 8);
        }
        else
        {
            GetXYInFrontOfPlayer(playerid, x, y, 5);
        }

        new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
        LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));

        format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
        SendClientMessage(playerid, l_green, String);
        return 1;
    }
    return 0;
}
ja tentei converter mas nao deu certo alguem me ajuda ?
Reply
#2

Up alguem me ajuda ?
Reply
#3

Sу usar zcmd e sscanf. Eu acho que este comando nгo usa inteiros e sу strings.
Entгo й sу usar o formato 's'.
Reply
#4

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
Sу usar zcmd e sscanf. Eu acho que este comando nгo usa inteiros e sу strings.
Entгo й sу usar o formato 's'.
ja tentei converter para zcmd mas da erro pedindo Srtotk
Reply
#5

Exemplo:
pawn Код:
if(strcmp(cmd, "/anuncio", true) == 0)
{
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, l_red, "Use: /anuncio texto");
    format(string, sizeof string, "%s", tmp);
    SendClientMessageToAll(-1, string);
    return 1;
}
pawn Код:
CMD:anuncio(playerid, params[])
{
    new string[129], msg[129];
    if(sscanf(params, "s[128]", msg));
    {
        SendClientMessage(playerid, -1, "Use: /anuncio texto");
        return 1;
    }
    format(string, sizeof string, "%s", msg);
    SendClientMessageToAll(-1, string);
    return 1;
}
Se der esse erro й porque o comando ainda estб usando strtok.
Reply
#6

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
Exemplo:
pawn Код:
if(strcmp(cmd, "/anuncio", true) == 0)
{
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, l_red, "Use: /anuncio texto");
    format(string, sizeof string, "%s", tmp);
    SendClientMessageToAll(-1, string);
    return 1;
}
pawn Код:
CMD:anuncio(playerid, params[])
{
    new string[129], msg[129];
    if(sscanf(params, "s[128]", msg));
    {
        SendClientMessage(playerid, -1, "Use: /anuncio texto");
        return 1;
    }
    format(string, sizeof string, "%s", msg);
    SendClientMessageToAll(-1, string);
    return 1;
}
Se der esse erro й porque o comando ainda estб usando strtok.
amigo fiz deste modo mas continua acusando
Reply
#7

Esta dando estes erros :
pawn Код:
error 017: undefined symbol "strtok"
error 033: array must be indexed (variable "tmp")
linhas do erro : tmp = strtok(cmdtext, idx);

comando :
pawn Код:
CMD:v(playerid, params[])
{
new String[200];
new tmp[256];
new Float:x, Float:y, Float:z;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,Vermelho, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, Verde, String);
return 1;
}
alguem aew me ajuda a converter ??
Reply
#8

Vocк deve usar sscanf ou params.
Sу sei usar sscanf com zcmd, o params, jб nгo sei.
Com params deve ser assim:
pawn Код:
CMD:v(playerid, params[])
{
new String[200];
new Float:x, Float:y, Float:z;
if(!strlen(params[0])) return SendClientMessage(playerid,Vermelho, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(params[0]);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, Verde, String);
return 1;
}
Sscanf:
pawn Код:
CMD:v(playerid, params[])
{
new String[200], nomecarro[50];
new Float:x, Float:y, Float:z;
if(sscanf(params,"s",nomecarro)) return SendClientMessage(playerid,Vermelho, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(nomecarro);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, Verde, String);
return 1;
}
Reply
#9

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
Vocк deve usar sscanf ou params.
Sу sei usar sscanf com zcmd, o params, jб nгo sei.
Com params deve ser assim:
pawn Код:
CMD:v(playerid, params[])
{
new String[200];
new Float:x, Float:y, Float:z;
if(!strlen(params[0])) return SendClientMessage(playerid,Vermelho, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(params[0]);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, Verde, String);
return 1;
}
Sscanf:
pawn Код:
CMD:v(playerid, params[])
{
new String[200], nomecarro[50];
new Float:x, Float:y, Float:z;
if(sscanf(params,"s",nomecarro)) return SendClientMessage(playerid,Vermelho, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(nomecarro);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, Verde, String);
return 1;
}
Vou tentar aqui amigo
Reply
#10

Amigo funcionou , poderia tambem me ajudar com um pequeno problema ?

Linhas :
pawn Код:
Linha 1 : CriarTextDraw(playerid), KillTimer(KillTimer(TempoTD[playerid])), 0;
Linha 2 : SumirTD(playerid), 0;
erros : Linha 1 e linha 2 warning 215: expression has no effect

caso queira ver este sistema veja o topico : https://sampforum.blast.hk/showthread.php?tid=485342
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)