SA-MP Forums Archive
The command does not work when I use - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: The command does not work when I use (/showthread.php?tid=623852)



The command does not work when I use - baela - 06.12.2016

Staff This is the command of weapons for the event most when I use it is not giving weapons
Код:
	if(strcmp(cmdtext, "/armarevento", true) == 0){
	if(!organizador[playerid] || pAdmin[playerid] < 5)return SendClientMessage(playerid,0xFF0000FF,"| INFO | Apenas Organizadores de Evento e Admins Pode Usar Esse Comando");
	if(!strlen(tmp))return SendClientMessage(playerid,0xFF0000FF,"Uso /armarevento [arma id] [balas]");
	new arma,balas;
	arma = strval(tmp);
	if(arma > 46)return SendClientMessage(playerid,0xFF0000FF,"| ERRO | Arma invalida");
	tmp = strtok(cmdtext,idx);
	if(!strlen(tmp))return SendClientMessage(playerid,0xFF0000FF,"Uso /armarevento [arma id] [balas]");
	balas = strval(tmp);
	for(new i, x = GetMaxPlayers(); i != x; ++i)
	{
	if(IsPlayerConnected(i) && InEvento[i] == 1)
	{
	GivePlayerWeapon(i,arma,balas);
	}
	}
	return 1;
	}



Re: The command does not work when I use - Micko123 - 06.12.2016

-deleted-


Re: The command does not work when I use - baela - 06.12.2016

There's nothing in the pastebin


Re: The command does not work when I use - Micko123 - 06.12.2016

Try this one
PHP код:
if(strcmp(cmdtext"/armarevento"true) == 0){
    if(!
organizador[playerid] || pAdmin[playerid] < 5)return SendClientMessage(playerid,0xFF0000FF,"| INFO | Apenas Organizadores de Evento e Admins Pode Usar Esse Comando");
    if(!
strlen(tmp))return SendClientMessage(playerid,0xFF0000FF,"Uso /armarevento [arma id] [balas]");
    new 
arma,balas;
    
arma strval(tmp);
    if(
arma 46)return SendClientMessage(playerid,0xFF0000FF,"| ERRO | Arma invalida");
    
tmp strtok(cmdtext,idx);
    if(!
strlen(tmp))return SendClientMessage(playerid,0xFF0000FF,"Uso /armarevento [arma id] [balas]");
    
balas strval(tmp);
    for(new 
0MAX_PLAYERSi++)
    {
    if(
IsPlayerConnected(i) && InEvento[i] == 1)
    {
    
GivePlayerWeapon(i,arma,balas);
    }
    }
    return 
1;
    } 



Re: The command does not work when I use - GoldenLion - 06.12.2016

Are you serious: strok and OnPlayerCommandText? Dude, command processors and sscanf exist.