SA-MP Forums Archive
Somethings wrong with my code -.- - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Somethings wrong with my code -.- (/showthread.php?tid=165351)



Somethings wrong with my code -.- - wesone - 04.08.2010

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



Re: Somethings wrong with my code -.- - willsuckformoney - 04.08.2010

post errors && warnings if there are any

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

&& giveplayerid defined?


Re: Somethings wrong with my code -.- - Mike Garber - 04.08.2010

Oh, Hi. So, how can we help you?


AW: Somethings wrong with my code -.- - wesone - 04.08.2010

there are no warnings/errors

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

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


Re: Somethings wrong with my code -.- - Faith - 04.08.2010

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


Re: Somethings wrong with my code -.- - Mike Garber - 04.08.2010

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


Re: Somethings wrong with my code -.- - willsuckformoney - 04.08.2010

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


AW: Somethings wrong with my code -.- - wesone - 04.08.2010

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)


AW: Somethings wrong with my code -.- - wesone - 05.08.2010

no ideas how to fix?


Re: Somethings wrong with my code -.- - KennethRandall - 05.08.2010

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