Problem with a FS/part of code. -
Da' J' - 27.01.2012
Ok, i've got an auto-crack script, but I can't "install" it into my gamemode. So, I tried to compile it in FS, and i get 4 warnings. I try it IG, but it only puts a player once in auto-crack after lower HP than 25, /getup nor helpup isn't working at all, timers aren't working. Some help?
Script:
pawn Код:
#include <a_samp>
#define FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Auto-crack...");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
enum crack2
{
bool: is_cracked,
timer,
c_down,
bool:c_isover,
Float:health
};
new crack[MAX_PLAYERS][crack2];
forward Crack_Timer(playerid);
forward Count_Down(playerid);
public OnPlayerSpawn(playerid)
{
crack[playerid][is_cracked] = false;
crack[playerid][c_isover] = false;
crack[playerid][timer] = SetTimerEx("Crack_Timer",1500,true,"i",playerid);
return 1;
}
public Crack_Timer(playerid)
{
GetPlayerHealth(playerid,crack[playerid][health]);
if( (crack[playerid][health] <= 20) && (crack[playerid][is_cracked] == false) )
{
crack[playerid][is_cracked] = true;
ApplyAnimation(playerid,"PED","KO_spin_L",2.8,0,1,1,1,0);
crack[playerid][c_down] = SetTimerEx("Count_Down", 5 * 60 * 1000, false, "i", playerid);
}
return 1;
}
public Count_Down(playerid)
{
if(crack[playerid][is_cracked] == true) {
crack[playerid][c_isover] = true;
KillTimer(crack[playerid][timer]);
}
return 1;
}
PlayerToPlayer(playerid,toplayerid)
{
new Float:pos[2][3];
GetPlayerPos(playerid,pos[0][0],pos[0][1],pos[0][2]);
GetPlayerPos(toplayerid,pos[1][0],pos[1][1],pos[1][2]);
pos[0][0] -= pos[1][0];
pos[0][1] -= pos[1][1];
pos[0][2] -= pos[1][2];
return floatround( floatsqroot( (floatpower(pos[0][0],2) + floatpower(pos[0][1],2) + floatpower(pos[0][2],2) ) ), floatround_round);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/getup",true))
{
if( (crack[playerid][is_cracked] == true) && (crack[playerid][c_isover] == true) )
{
SendClientMessage(playerid, -1, "You got up!");
crack[playerid][is_cracked] = false;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
TogglePlayerControllable(playerid, true);
KillTimer(crack[playerid][timer]);
KillTimer(crack[playerid][c_down]);
}
return 1;
}
if(!strcmp(cmdtext,"/helpup",true,9))
{
if(!cmdtext[8]) SendClientMessage(playerid,-1,"USAGE: /helpup [ID]");
else if (PlayerToPlayer(playerid,cmdtext[9]) >= 5) SendClientMessage(playerid,-1,"Player too far!");
else if( (crack[cmdtext[9]][is_cracked] == true) && (cmdtext[9] != playerid))
{
ApplyAnimation(playerid,"BOMBER","BOM_Plant",2.6,1,1,1,0,6800);
crack[cmdtext[9]][is_cracked] = false;
crack[cmdtext[9]][c_isover] = false;
KillTimer(crack[cmdtext[9]][timer]);
KillTimer(crack[cmdtext[9]][c_down]);
SetPlayerSpecialAction(cmdtext[9],SPECIAL_ACTION_NONE);
}
return 1;
}
Re: Problem with a FS/part of code. -
papedo - 27.01.2012
What warnings and and what lines ?
Re: Problem with a FS/part of code. - T0pAz - 27.01.2012
Show us your warnings. We are not psychic.
Re: Problem with a FS/part of code. -
Da' J' - 27.01.2012
Well now i got an error aswell O.o
pawn Код:
C:\Users\Joni\Desktop\SA-MP Offical Server\filterscripts\autocrack.pwn(85) : warning 217: loose indentation
C:\Users\Joni\Desktop\SA-MP Offical Server\filterscripts\autocrack.pwn(89) : warning 217: loose indentation
C:\Users\Joni\Desktop\SA-MP Offical Server\filterscripts\autocrack.pwn(102) : warning 217: loose indentation
C:\Users\Joni\Desktop\SA-MP Offical Server\filterscripts\autocrack.pwn(104) : warning 217: loose indentation
C:\Users\Joni\Desktop\SA-MP Offical Server\filterscripts\autocrack.pwn(107) : error 030: compound statement not closed at the end of file (started at line 78)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Line 85: TogglePlayerControllable(playerid, true);
Line 89: return 1;
Line 102: SetPlayerSpecialAction(cmdtext[9],SPECIAL_ACTION_NONE);
Line 104: return 1;
Line 107: Nothing...
Re: Problem with a FS/part of code. -
[HK]Ryder[AN] - 27.01.2012
WHat is line 78?
It says that you have not closed a compound statement that started at line 78.Also the other warning s are because of a space or something.Never press Space to move forward in pawn always press Tab and you will move forward and there will be no loose indentations.
Re: Problem with a FS/part of code. -
Da' J' - 27.01.2012
Line 78 is if(!strcmp(cmdtext,"/getup",true))
And i got one warning away now, but others aren't going... Even i re-do the tab hitting..
Re: Problem with a FS/part of code. -
Da' J' - 27.01.2012
Nevermind I got now all the warnings off, but that error is pissing me off. -_-
Re: Problem with a FS/part of code. -
[XST]O_x - 27.01.2012
You're just missing a return 0; and a } at the end of OnPlayerCommandText.
At this at the end of your script:
Re: Problem with a FS/part of code. -
SchurmanCQC - 27.01.2012
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/getup",true))
{
if( (crack[playerid][is_cracked] == true) && (crack[playerid][c_isover] == true) )
{
SendClientMessage(playerid, -1, "You got up!");
crack[playerid][is_cracked] = false;
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
TogglePlayerControllable(playerid, true);
KillTimer(crack[playerid][timer]);
KillTimer(crack[playerid][c_down]);
}
return 1;
}
if(!strcmp(cmdtext,"/helpup",true,9))
{
if(!cmdtext[8]) SendClientMessage(playerid,-1,"USAGE: /helpup [ID]");
else if (PlayerToPlayer(playerid,cmdtext[9]) >= 5) SendClientMessage(playerid,-1,"Player too far!");
else if( (crack[cmdtext[9]][is_cracked] == true) && (cmdtext[9] != playerid))
{
ApplyAnimation(playerid,"BOMBER","BOM_Plant",2.6,1,1,1,0,6800);
crack[cmdtext[9]][is_cracked] = false;
crack[cmdtext[9]][c_isover] = false;
KillTimer(crack[cmdtext[9]][timer]);
KillTimer(crack[cmdtext[9]][c_down]);
SetPlayerSpecialAction(cmdtext[9],SPECIAL_ACTION_NONE);
}
return 1;
}
return 0;
}
Re: Problem with a FS/part of code. -
Da' J' - 27.01.2012
Well now it works! Was thinking that it must be about the return value lol. So that's how it should be.
Rep+