[PEDIDO] Comando para da Respawn em todos os carros
#1

Alguйm me ajuda?? Procurei no ****** e no search e nгo achei o comando de respawnar todos os carros, quem tiver encontrado me passa o link ou faz pra mim, de preferкncia que seja sу logado na RCON.

Obrigado.
Reply
#2

@DoublePost

Desculpe eu achei, mais alguйm sabe como faзo um cуdigo que se refere pra sу admin logado na RCON que possa mecher??

Aqui estб o cуdigo, eu quero deixar sу pra admin logado na RCON

pawn Код:
if(strcmp("/Respawn", cmdtext, true, 10) == 0)
    {
    ResetarCarros();
    return 1;
    }
Reply
#3

PHP код:
if(strcmp("/Respawn"cmdtexttrue10) == 0)
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"Vocк nгo estб logado na RCON.");
    
ResetarCarros();
    return 
1;

https://sampwiki.blast.hk/wiki/IsPlayerAdmin
Reply
#4

retirei do meu gm:
pawn Код:
stock ResetarCarros(playerid)
{
    format(string, sizeof(string), "[INFO]: O Adminstrador %s Respawnou todos os veiculos", GetPlayerNick(playerid));
    SendClientMessageToAll(Verde, string);
    static inVeh;
    for( new i = 0; i < MAX_VEHICLES; i++ )
    {
        inVeh = false;
        for( new j = 0; j < SLOTS; j++ )
        {
            if(IsPlayerInVehicle( j, i ))
            {
                inVeh = true;
                break;
            }
        }
        if(inVeh == false)
        {
            SetVehicleToRespawn(i);
        }
    }
}
creditos ...my
Reply
#5

ai TheGarfield essa linha sua de esse warning
pawn Код:
if(inVeh == false)
pawn Код:
D:\Servers\Samp\gamemodes\EmConstruзao.pwn(27334) : warning 213: tag mismatch
como tirar esse warning ?
Reply
#6

Quote:
Originally Posted by lucas_mdr1235
Посмотреть сообщение
ai TheGarfield essa linha sua de esse warning
pawn Код:
if(inVeh == false)
pawn Код:
D:\Servers\Samp\gamemodes\EmConstruзao.pwn(27334) : warning 213: tag mismatch
como tirar esse warning ?
Isto deve resolver o seu problema .


Basta trocб-la por :


pawn Код:
if(~InVeh == -1)

Espero ter ajudado .
Reply
#7

~? Q isso?
Reply
#8

Quote:
Originally Posted by lucas_mdr1235
Посмотреть сообщение
ai TheGarfield essa linha sua de esse warning
pawn Код:
if(inVeh == false)
pawn Код:
D:\Servers\Samp\gamemodes\EmConstruзao.pwn(27334) : warning 213: tag mismatch
como tirar esse warning ?
ah, bota isto: if(!inVeh)
Reply
#9

tiro vlw S2 ! ! !
Reply
#10

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
1 - O que й isso: if(~InVeh == -1) ?

2 - Qual a diferenзa de static e new ?

3 - O correto nгo seria static inVeh[MAX_VEHICLES]; ?
Static й uma variбvel STATICA, ou seja, vocк nгo pode modificar, й um valor.
News sгo acopladas na memуria dinвmica.., Dynamic Memory Allocation

Variбveis static's sгo acopladas na memуria estatica, Static Memory Allocation

Quote:
Originally Posted by REI_DO_SAMP_SR_Y_LESS
I think I'll clarify a bit here, as those definitions were a little bit off. In a script you have global memory and stack/heap memory. The global memory is where all your global variables are stored, as they're not different in different functions. This memory is actually included into the .amx, which is why a tiny .pwn can produce a huge .amx. The stack and heap are allocated when you execute the script and store function local variables, this is because a function can call itself, so you need two copies of the same variable - if they were global they would be the same variable.

Local static variables are essentially global variables, but you can only use them in one function. If you decompile a .amx with static locals you will see them listed as globals - them being limited to one function is purely a compiler restriction, there's actually nothing in the VM itself to enforce this.

A const variable is not variable, it is just like a macro in that it always has the same value - it's just useful for defining things.

A global static variable is limited to only being used in the file in which it's declared (technically section, a file can have multiple sections, but a section can't have multiple files and the default is one section per file). These are used extensively through YSI to hide implementation details from people and stop them breaking things. But again, this is purely a compiler restriction.

Edit: You said you've been told 201 times, but it's clearly not sunk in yet, so I'm telling you a 202nd time: Don't use 256 for command variables, it's entirely pointless and a waste, the effects of which you are clearly seeing in your code or you wouldn't be getting heap space overflows when you compile.

I'm also going to tell you to use zcmd and sscanf - you say that you use those variables in almost every command, you'll use them in next to none if you bother to code properly, plus your code will be faster and more secure.
Reply
#11

Quote:
Originally Posted by Shadoww5
Посмотреть сообщение
PHP код:
if(strcmp("/Respawn"cmdtexttrue10) == 0)
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"Vocк nгo estб logado na RCON.");
    
ResetarCarros();
    return 
1;

https://sampwiki.blast.hk/wiki/IsPlayerAdmin
Vlw funciono perfeitamente nos meus comandos, agora ninguйm vai abusar mais xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)