Erros no SampForever e sistema pra salvar o email da pessoa D: e criar carro sem alterar o id deles
#10

Quote:
Originally Posted by [NWD]Jim._.Carrey
Посмотреть сообщение
Edit:

Ta ae manolo:

pawn Код:
#include <a_samp>

new
    vehevento[MAX_VEHICLES], veheventoID = 505;
   
public OnFilterScriptInit()
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new
        cmd[128], idx, tmp[128];

    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/vehevento", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1, "Uso correto: /vehevento [cor1] [cor2]");
            return 1;
        }
        new veiculo = strval(tmp);
        if(veiculo < 400 || veiculo > 611)
        {
            SendClientMessage(playerid, -1, "Somente veнculos entre os ID: 400 б 611");
            return 1;
        }
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1, "Uso: /vehevento [cor1] [cor2]");
            return 1;
        }
        new color1 = strval(tmp);
        tmp = strtok(cmdtext, idx);
        new color2 = strval(tmp);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1, "Uso: /vehevento [id veнculo] [cor1] [cor2]");
            return 1;
        }
        new Float:EVX, Float:EVY, Float:EVZ, Float:EVA;
        GetPlayerPos(playerid, EVX, EVY, EVZ);
        GetPlayerFacingAngle(playerid, EVA);
        new currentveh;
        new Float:z_rot;
        currentveh = GetPlayerVehicleID(playerid);
        GetVehicleZAngle(currentveh, z_rot);
        if(IsPlayerInAnyVehicle(playerid))
        {
            DestroyVehicle(GetPlayerVehicleID(playerid));
            PutPlayerInVehicle(playerid, vehevento[veheventoID] = CreateVehicle( veiculo, EVX, EVY, EVZ, z_rot, color1, color2, -1), 0);
        }
        else
        {
            PutPlayerInVehicle(playerid, vehevento[veheventoID] = CreateVehicle( veiculo, EVX, EVY, EVZ, EVA, color1, color2, -1), 0);
        }
        veheventoID ++;
        return 1;
    }
    return 1;
}

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;
}
Amigo, acho que ali em cima ele disse "ZCMD". Entгo utilize esse code:

pawn Код:
CMD:vehevento(playerid, params[])
{
    new cmd[128], idx, tmp[128];
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, -1, "Uso correto: /vehevento [cor1] [cor2]");
        return 1;
    }
    new veiculo = strval(tmp);
    if(veiculo < 400 || veiculo > 611)
    {
        SendClientMessage(playerid, -1, "Somente veнculos entre os ID: 400 б 611");
        return 1;
    }
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, -1, "Uso: /vehevento [cor1] [cor2]");
        return 1;
    }
    new color1 = strval(tmp);
    new color2 = strval(tmp);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, -1, "Uso: /vehevento [id veнculo] [cor1] [cor2]");
        return 1;
    }
    new Float:EVX, Float:EVY, Float:EVZ, Float:EVA;
    GetPlayerPos(playerid, EVX, EVY, EVZ);
    GetPlayerFacingAngle(playerid, EVA);
    new currentveh;
    new Float:z_rot;
    currentveh = GetPlayerVehicleID(playerid);
    GetVehicleZAngle(currentveh, z_rot);
    if(IsPlayerInAnyVehicle(playerid))
    {
        DestroyVehicle(GetPlayerVehicleID(playerid));
        PutPlayerInVehicle(playerid, vehevento[veheventoID] = CreateVehicle( veiculo, EVX, EVY, EVZ, z_rot, color1, color2, -1), 0);
    }
    else
    {
        PutPlayerInVehicle(playerid, vehevento[veheventoID] = CreateVehicle( veiculo, EVX, EVY, EVZ, EVA, color1, color2, -1), 0);
    }
    veheventoID ++;
    return 1;
}

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;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)