SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 27/10/2013, 04:01 AM   #1
Catchorro
Big Clucker
 
Catchorro's Avatar
 
Join Date: Oct 2013
Location: Pawn Copiler
Posts: 199
Reputation: 33
Lightbulb Criar Um Comando /cv

Como criar um comando de cria um veiculo temporario . quando o player sai do carro ele some ou fica ate cria outro um bem simples ? /cv mais tem que ser pelo

if(strcmp(cmdtext, "/cv", true) == 0)

Para Dar certo no meu gm """""
Catchorro is offline   Reply With Quote
Old 27/10/2013, 04:07 AM   #2
BielCOP
Banned
 
Join Date: Nov 2012
Location: Estado de SP
Posts: 1,125
Reputation: -8
Default Re: Criar Um Comando /cv

Code:
// Topo do GM

new VeiculoPlayer[MAX_PLAYERS];

// OnPlayerUpdate

if(VeiculoPlayer[playerid])
{
	if(!IsPlayerInAnyVehicle(playerid))
	{
	    OnPlayerCommandText(playerid,"/dcv");
	}
}

// Comando

if(strcmp(cmd, "/cv", true) == 0)
{
	if(VeiculoPlayer[playerid] >= 1)
	{
		SendClientMessage(playerid,0xBFBFBFAA,"Use /dcv.");
		return 1;
	}
	tmp = strtok(cmdtext,idx);

	if(!strlen(tmp))
   	{
    	SendClientMessageEx(playerid, 0xBFC0C2AA, "Uso Correto: /cv [Veiculo ID]");
    	return 1;
   	}
   	new car = strval(tmp);

	if(car < 400 || car > 611)
	{
		SendClientMessageEx(playerid, 0xBFBFBFAA, "IDs de 400 a 611.");
		return 1;
	}
	new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);

	VeiculoPlayer[playerid] = CreateVehicle(car, X,Y,Z, 0.0, -1, -1,36000000);
  	return 1;
}
if(strcmp(cmd, "/dcv", true) == 0)
{
	if(VeiculoPlayer[playerid] == 0)
	{
		SendClientMessage(playerid,0xBFBFBFAA,"Você não criou um veículo!");
		return 1;
	}
    SendClientMessage(playerid,0xBFBFBFAA,"O seu veículo Foi destruído!");

	DestroyVehicle(VeiculoPlayer[playerid]);
	VeiculoPlayer[playerid] = 0;

	return 1;
}
BielCOP is offline   Reply With Quote
Old 27/10/2013, 05:02 AM   #3
Catchorro
Big Clucker
 
Catchorro's Avatar
 
Join Date: Oct 2013
Location: Pawn Copiler
Posts: 199
Reputation: 33
Default Re: Criar Um Comando /cv

biel mais isso encaixa no meu server cmdtext?
Catchorro is offline   Reply With Quote
Old 27/10/2013, 05:05 AM   #4
BielCOP
Banned
 
Join Date: Nov 2012
Location: Estado de SP
Posts: 1,125
Reputation: -8
Default Re: Criar Um Comando /cv

Sim
BielCOP is offline   Reply With Quote
Old 27/10/2013, 05:07 AM   #5
Catchorro
Big Clucker
 
Catchorro's Avatar
 
Join Date: Oct 2013
Location: Pawn Copiler
Posts: 199
Reputation: 33
Default Re: Criar Um Comando /cv

erro !
Catchorro is offline   Reply With Quote
Old 27/10/2013, 05:10 AM   #6
BielCOP
Banned
 
Join Date: Nov 2012
Location: Estado de SP
Posts: 1,125
Reputation: -8
Default Re: Criar Um Comando /cv

Qual erro ?
BielCOP is offline   Reply With Quote
Old 27/10/2013, 05:18 AM   #7
Catchorro
Big Clucker
 
Catchorro's Avatar
 
Join Date: Oct 2013
Location: Pawn Copiler
Posts: 199
Reputation: 33
Default Re: Criar Um Comando /cv

Tae !
Quote:
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(545) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(553) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(553) : error 017: undefined symbol "idx"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(555) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(557) : error 017: undefined symbol "SendClientMessageEx"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(561) : error 017: undefined symbol "tmp"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(565) : error 017: undefined symbol "SendClientMessageEx"
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(575) : error 017: undefined symbol "cmd"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


8 Errors.
Catchorro is offline   Reply With Quote
Old 27/10/2013, 05:25 AM   #8
BielCOP
Banned
 
Join Date: Nov 2012
Location: Estado de SP
Posts: 1,125
Reputation: -8
Default Re: Criar Um Comando /cv

Code:
new cmd[128],tmp[128],idx; cmd = strtok(cmdtext,idx);

if(strcmp(cmd, "/cv", true) == 0)
{
    if(VeiculoPlayer[playerid] >= 1)
    {
        SendClientMessage(playerid,0xBFBFBFAA,"Use /dcv.");
        return 1;
    }
    tmp = strtok(cmdtext,idx);

    if(!strlen(tmp))
    {
        SendClientMessage(playerid, 0xBFC0C2AA, "Uso Correto: /cv [Veiculo ID]");
        return 1;
    }
    new car = strval(tmp);

    if(car < 400 || car > 611)
    {
        SendClientMessage(playerid, 0xBFBFBFAA, "IDs de 400 a 611.");
        return 1;
    }
    new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);

    VeiculoPlayer[playerid] = CreateVehicle(car, X,Y,Z, 0.0, -1, -1,36000000);
    return 1;
}
if(strcmp(cmd, "/dcv", true) == 0)
{
    if(VeiculoPlayer[playerid] == 0)
    {
        SendClientMessage(playerid,0xBFBFBFAA,"Você não criou um veículo!");
        return 1;
    }
    SendClientMessage(playerid,0xBFBFBFAA,"O seu veículo Foi destruído!");

    DestroyVehicle(VeiculoPlayer[playerid]);
    VeiculoPlayer[playerid] = 0;

    return 1;
}
BielCOP is offline   Reply With Quote
Old 27/10/2013, 05:27 AM   #9
Catchorro
Big Clucker
 
Catchorro's Avatar
 
Join Date: Oct 2013
Location: Pawn Copiler
Posts: 199
Reputation: 33
Default Re: Criar Um Comando /cv

Ops Quassee Bieeell
Quote:
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(545) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Lanterna Negra\Desktop\Projeto\gamemodes\Projeto.pwn(554) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Linha 545

Quote:
new cmd[128],tmp[128],idx; cmd = strtok(cmdtext,idx);
Linha 554

Quote:
tmp = strtok(cmdtext,idx);
Catchorro is offline   Reply With Quote
Old 27/10/2013, 05:33 AM   #10
BielCOP
Banned
 
Join Date: Nov 2012
Location: Estado de SP
Posts: 1,125
Reputation: -8
Default Re: Criar Um Comando /cv

Code:
new cmd[168];
new tmp[168];
new idx;

cmd = strtok(cmdtext,idx);

if(strcmp(cmd, "/cv", true) == 0)
{
    if(VeiculoPlayer[playerid] >= 1)
    {
        SendClientMessage(playerid,0xBFBFBFAA,"Use /dcv.");
        return 1;
    }
    tmp = strtok(cmdtext,idx);

    if(!strlen(tmp))
    {
        SendClientMessage(playerid, 0xBFC0C2AA, "Uso Correto: /cv [Veiculo ID]");
        return 1;
    }
    new car = strval(tmp);

    if(car < 400 || car > 611)
    {
        SendClientMessage(playerid, 0xBFBFBFAA, "IDs de 400 a 611.");
        return 1;
    }
    new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z);

    VeiculoPlayer[playerid] = CreateVehicle(car, X,Y,Z, 0.0, -1, -1,36000000);
    return 1;
}
if(strcmp(cmd, "/dcv", true) == 0)
{
    if(VeiculoPlayer[playerid] == 0)
    {
        SendClientMessage(playerid,0xBFBFBFAA,"Você não criou um veículo!");
        return 1;
    }
    SendClientMessage(playerid,0xBFBFBFAA,"O seu veículo Foi destruído!");

    DestroyVehicle(VeiculoPlayer[playerid]);
    VeiculoPlayer[playerid] = 0;

    return 1;
}

// Fim do 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;
}
BielCOP is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Pedido] Podem criar o comando /aestacionar para mim? Não consigo criar tristtok Português/Portuguese 18 22/09/2013 07:36 PM
[Ajuda] Como criar o comando /rg DaviCOP Português/Portuguese 2 24/06/2013 07:40 PM
[Ajuda] Criar objeto com comando! SkullFire Português/Portuguese 9 05/05/2013 03:41 PM
[Ajuda] Ajuda Criar comando brunoboy Português/Portuguese 21 21/07/2012 12:34 PM
[DUV] criar um comando Lucas_Brasil Português/Portuguese 6 24/01/2010 08:04 PM


All times are GMT. The time now is 10:39 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.