Somethings wrong with my code -.-
#1

i tested a bit with explosions just 4 fun but it wont work -.-
Код:
               if(strcmp(cmd, "/burn", true) == 0)
		{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_WHITE, "/burn [PlayerID/Name]");
			return 1;
		}
		playerid = strval(tmp);
		GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		if(IsPlayerConnected(giveplayerid))
		{
			if(IsPlayerAdmin(playerid))
			{
			    if(IsPlayerConnected(giveplayerid))
			    {
					new Float:explosionx, Float:explosiony, Float:explosionz;
					GetPlayerPos(giveplayerid, explosionx, explosiony, explosionz);
					CreateExplosion(explosionx, explosiony , explosionz, 1, 1);
				}
				else
				{
				    format(string, sizeof(string), "%d is offline.", giveplayerid);
					SendClientMessage(playerid, COLOR_YELLOW, string);
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_WHITE, "SERVER: Unknown command.");
			}
		}
		return 1;
		}
Reply
#2

post errors && warnings if there are any

&& i see no string[128]; or what ever

&& giveplayerid defined?
Reply
#3

Oh, Hi. So, how can we help you?
Reply
#4

there are no warnings/errors

string[128]... hmm i dont know^^

giveplayerid is not defined but i used it before and that works
Reply
#5

replace
pawn Код:
playerid = strval(tmp);
with
pawn Код:
giveplayerid = strval(tmp);
If you get any errors, add new giveplayerid; at the top of your command.
Reply
#6

I can see the error, the error is;

playerid = strval(tmp);

Should be giveplayerid = strval(tmp);

Otherwise, now, it checks if the person you wanna burn is an admin, if not It wont do It.

Edit: Too late xD
Reply
#7

&& try addind str[128]; somewhere onplayercommandtext at top or in the code
Reply
#8

ok thank u guys it works (without str[128]^^)

...but if i try /burn 2 (while 2 players are conncted) nothing happens (although i should get the message that this id is not online)
Reply
#9

no ideas how to fix?
Reply
#10

just use:
pawn Код:
if(giveplayerid != INVALID_PLAYER_ID)
{
and at the bottom:
pawn Код:
}
else SendClientMessage(playerid, color, "Player not connected');
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)