SA-MP Forums Archive
Why isnt this working more me now? - 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: Why isnt this working more me now? (/showthread.php?tid=187124)



Why isnt this working more me now? - <Weponz> - 01.11.2010

This code worked fine before whats wrong with it :O

Код:
//--Weponz Trick'Or'Treat System!--//

#include <a_samp>
#include <CheckpointManager>
#include <dini>
#include <dudb>

#pragma unused ret_memcpy

#define FILTERSCRIPT
#define COLOR_RED		    0xFF0000FF

#define TRICK_OR_TREAT1 1
#define TRICK_OR_TREAT2 2
#define TRICK_OR_TREAT3 3
#define TRICK_OR_TREAT4 4

new PlayerInfo[MAX_PLAYERS][pInfo];

new bool:trickortreat[MAX_PLAYERS];
new bool:cantrickortreat[MAX_PLAYERS];
new bool:waittrickortreat[MAX_PLAYERS];


forward OnCheckpointEXIT(playerid, checkpointid);
forward waittreat(playerid);
forward treattimer();
forward treat(playerid);

enum pInfo
{
	TreatAmount,
}

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Weponz Trick'Or'Treat System Loaded!");
	print("--------------------------------------\n");
	
    CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT1, -1460.6313,-1452.2644,101.7578, 2.0);//Coordz Random Need To Be Set!
    CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT2, -1459.6176,-1561.0852,101.7578, 2.0);//
    CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT3, -1083.4073,-1264.9041,129.2188, 2.0);//
    CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT4, -1025.8848,-1252.8379,130.2696, 2.0);//
	StartCheckpointSeeking();
	
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#endif

public OnPlayerSpawn(playerid)
{
	return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/candy", cmdtext, true) == 0)
        {
        new ammount[64];
        format(ammount, sizeof(ammount),"You have %d Candy!",PlayerInfo[playerid][TreatAmount] );
        SendClientMessage(playerid, COLOR_RED, "-----Fuel Ammount-----");
        SendClientMessage(playerid, COLOR_RED, ammount);
        return 1;
        }
    if(!strcmp(cmdtext,"/trickortreat",true))//Weponz
        {
        if (IsPlayerInCheckpoint(playerid))
        if(waittrickortreat[playerid] == true)
		{
		SendClientMessage(playerid, COLOR_RED, "Please wait before Trick'Or'Treating again!");
		}
        if(cantrickortreat[playerid] == true)
        {
        if(trickortreat[playerid] == false)
	    {
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "%s is Trick'Or'Treating right now!", str, cmdtext[4]);
        SendClientMessageToAll(COLOR_RED, str);
		GameTextForPlayer(playerid, "~w~Your Trick'Or'Treating! ~r~Please wait!",10000,5);
		SetTimerEx("waittreat", 10000, false, "d", playerid);
		trickortreat[playerid] = true;
		}
		else
		{
		SendClientMessage(playerid, COLOR_RED, "You are Trick'Or'Treating!");
		}
		}
		else
		{
		SendClientMessage(playerid, COLOR_RED, "You need to be in a Checkpoint to Trick'Or'Treat! ");
		}
        return 1;
    }
	return 0;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    VerifyCheckpointe(playerid);
	return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
	VerifyCheckpoint(playerid);
	return 1;
}
public OnCheckpointEXIT(playerid, checkpointid)
	switch(checkpointid)
	{
	    case TRICK_OR_TREAT1:
	   	{
	  		if(cantrickortreat[playerid] == true)
	    	{
				cantrickortreat[playerid] = false;
				if(trickortreat[playerid] == true)
				{
					trickortreat[playerid] = false;
					GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5);
					SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!");
                    }
		      }
		}
        case TRICK_OR_TREAT2:
	   	{
	  		if(cantrickortreat[playerid] == true)
	    	{
				cantrickortreat[playerid] = false;
				if(trickortreat[playerid] == true)
				{
					trickortreat[playerid] = false;
					GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5);
					SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!");
				}
			 }
        }
        case TRICK_OR_TREAT3:
	   	{
	  		if(cantrickortreat[playerid] == true)
	    	{
				cantrickortreat[playerid] = false;
				if(trickortreat[playerid] == true)
				{
					trickortreat[playerid] = false;
					GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5);
					SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!");
				}
            }
        }
	    case TRICK_OR_TREAT4:
	   	{
	  		if(cantrickortreat[playerid] == true)
	    	{
				cantrickortreat[playerid] = false;
				if(trickortreat[playerid] == true)
				{
					trickortreat[playerid] = false;
					GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5);
					SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!");
				}
			 }
       }
}
public OnCheckpointEnter(playerid, checkpointid)
{
	switch(checkpointid)
	{
	    case TRICK_OR_TREAT1:
		{
	 		cantrickortreat[playerid] = true;
	 		{
	 		    GameTextForPlayer(playerid, "~r~/trickortreat",4000,5);
	 		}
	 	}
		case TRICK_OR_TREAT2:
		{
	 		cantrickortreat[playerid] = true;
	 		{
	 		    GameTextForPlayer(playerid, "~r~/trickortreat",4000,5);
	 		}
	 	}
		case TRICK_OR_TREAT3:
		{
	 		cantrickortreat[playerid] = true;
	 		{
	 		    GameTextForPlayer(playerid, "~r~/trickortreat",4000,5);
	 		}
	 	}
		case TRICK_OR_TREAT4:
		{
	 		cantrickortreat[playerid] = true;
	 		{
	 		    GameTextForPlayer(playerid, "~r~/trickortreat",4000,5);
	 		}
	 	}
	}
}
public treat(playerid)
{
    new str[128];
	new name[MAX_PLAYER_NAME];
	format(str, sizeof(str), "You just got some more Candy! Use /candy to see your Candy Supply!");
    SendClientMessage(playerid, COLOR_RED, str);
	GetPlayerName(playerid,name,18);
	format(str, sizeof(str), "%s has just got some more Candy! Use /trickortreat at any Candy Checkpoint for some Candy!",name,playerid);
	SendClientMessageToAll(COLOR_RED,str);
 	SetTimerEx("waittreat", 10000, false, "d", playerid);
 	trickortreat[playerid] = false;
 	PlayerInfo[playerid][TreatAmount] = PlayerInfo[playerid][TreatAmount] +100;
 	format(str, sizeof(str), "~r~Trick Or Treat!~n~~w~You have an extra 100 Candy Now!");
 	GameTextForPlayer(playerid, str ,4000,5);
    return 1;
}
public waittreat(playerid)
{
    waittrickortreat[playerid] = false;
    return 1;
}
I get these errors

Код:
C:\Users\Weponz\Desktop\Server Files\filterscripts\Trick'Or'Treat.pwn(18) : error 017: undefined symbol "pInfo"
C:\Users\Weponz\Desktop\Server Files\filterscripts\Trick'Or'Treat.pwn(18) : error 009: invalid array size (negative, zero or out of bounds)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Please help :S


Re: Why isnt this working more me now? - Slice - 01.11.2010

pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
PAWN doesn't know what pInfo is; did you accidently remove an enum or something?


Re: Why isnt this working more me now? - Retardedwolf - 01.11.2010

Quote:
Originally Posted by g_aSlice
Посмотреть сообщение
pawn Код:
new PlayerInfo[MAX_PLAYERS][pInfo];
PAWN doesn't know what pInfo is; did you accidently remove an enum or something?
He did put it in but he put it before he added the enum.


Re: Why isnt this working more me now? - (SF)Noobanatior - 01.11.2010

Код:
//--Weponz Trick'Or'Treat System!--//

#include <a_samp>
#include <CheckpointManager>
#include <dini>
#include <dudb>

#pragma unused ret_memcpy

#define FILTERSCRIPT
#define COLOR_RED		    0xFF0000FF

#define TRICK_OR_TREAT1 1
#define TRICK_OR_TREAT2 2
#define TRICK_OR_TREAT3 3
#define TRICK_OR_TREAT4 4


new bool:trickortreat[MAX_PLAYERS];
new bool:cantrickortreat[MAX_PLAYERS];
new bool:waittrickortreat[MAX_PLAYERS];


forward OnCheckpointEXIT(playerid, checkpointid);
forward waittreat(playerid);
forward treattimer();
forward treat(playerid);

enum pInfo
{
	TreatAmount,
}
new PlayerInfo[MAX_PLAYERS][pInfo];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Weponz Trick'Or'Treat System Loaded!");
	print("--------------------------------------\n");
	
    CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT1, -1460.6313,-1452.2644,101.7578, 2.0);//Coordz Random Need To Be Set!
    CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT2, -1459.6176,-1561.0852,101.7578, 2.0);//
    CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT3, -1083.4073,-1264.9041,129.2188, 2.0);//
    CreateCheckpoint(GLOBAL_OWNER_ID, TRICK_OR_TREAT4, -1025.8848,-1252.8379,130.2696, 2.0);//
	StartCheckpointSeeking();
	
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#endif

public OnPlayerSpawn(playerid)
{
	return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/candy", cmdtext, true) == 0)
        {
        new ammount[64];
        format(ammount, sizeof(ammount),"You have %d Candy!",PlayerInfo[playerid][TreatAmount] );
        SendClientMessage(playerid, COLOR_RED, "-----Fuel Ammount-----");
        SendClientMessage(playerid, COLOR_RED, ammount);
        return 1;
        }
    if(!strcmp(cmdtext,"/trickortreat",true))//Weponz
        {
        if (IsPlayerInCheckpoint(playerid))
        if(waittrickortreat[playerid] == true)
		{
		SendClientMessage(playerid, COLOR_RED, "Please wait before Trick'Or'Treating again!");
		}
        if(cantrickortreat[playerid] == true)
        {
        if(trickortreat[playerid] == false)
	    {
        new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "%s is Trick'Or'Treating right now!", str, cmdtext[4]);
        SendClientMessageToAll(COLOR_RED, str);
		GameTextForPlayer(playerid, "~w~Your Trick'Or'Treating! ~r~Please wait!",10000,5);
		SetTimerEx("waittreat", 10000, false, "d", playerid);
		trickortreat[playerid] = true;
		}
		else
		{
		SendClientMessage(playerid, COLOR_RED, "You are Trick'Or'Treating!");
		}
		}
		else
		{
		SendClientMessage(playerid, COLOR_RED, "You need to be in a Checkpoint to Trick'Or'Treat! ");
		}
        return 1;
    }
	return 0;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    VerifyCheckpointe(playerid);
	return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
	VerifyCheckpoint(playerid);
	return 1;
}
public OnCheckpointEXIT(playerid, checkpointid)
	switch(checkpointid)
	{
	    case TRICK_OR_TREAT1:
	   	{
	  		if(cantrickortreat[playerid] == true)
	    	{
				cantrickortreat[playerid] = false;
				if(trickortreat[playerid] == true)
				{
					trickortreat[playerid] = false;
					GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5);
					SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!");
                    }
		      }
		}
        case TRICK_OR_TREAT2:
	   	{
	  		if(cantrickortreat[playerid] == true)
	    	{
				cantrickortreat[playerid] = false;
				if(trickortreat[playerid] == true)
				{
					trickortreat[playerid] = false;
					GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5);
					SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!");
				}
			 }
        }
        case TRICK_OR_TREAT3:
	   	{
	  		if(cantrickortreat[playerid] == true)
	    	{
				cantrickortreat[playerid] = false;
				if(trickortreat[playerid] == true)
				{
					trickortreat[playerid] = false;
					GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5);
					SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!");
				}
            }
        }
	    case TRICK_OR_TREAT4:
	   	{
	  		if(cantrickortreat[playerid] == true)
	    	{
				cantrickortreat[playerid] = false;
				if(trickortreat[playerid] == true)
				{
					trickortreat[playerid] = false;
					GameTextForPlayer(playerid, "~r~You left the Checkpoint! No Candy recieved!",4000,5);
					SendClientMessage(playerid, COLOR_RED, "You left the Checkpoint! No Candy recieved!");
				}
			 }
       }
}
public OnCheckpointEnter(playerid, checkpointid)
{
	switch(checkpointid)
	{
	    case TRICK_OR_TREAT1:
		{
	 		cantrickortreat[playerid] = true;
	 		{
	 		    GameTextForPlayer(playerid, "~r~/trickortreat",4000,5);
	 		}
	 	}
		case TRICK_OR_TREAT2:
		{
	 		cantrickortreat[playerid] = true;
	 		{
	 		    GameTextForPlayer(playerid, "~r~/trickortreat",4000,5);
	 		}
	 	}
		case TRICK_OR_TREAT3:
		{
	 		cantrickortreat[playerid] = true;
	 		{
	 		    GameTextForPlayer(playerid, "~r~/trickortreat",4000,5);
	 		}
	 	}
		case TRICK_OR_TREAT4:
		{
	 		cantrickortreat[playerid] = true;
	 		{
	 		    GameTextForPlayer(playerid, "~r~/trickortreat",4000,5);
	 		}
	 	}
	}
}
public treat(playerid)
{
    new str[128];
	new name[MAX_PLAYER_NAME];
	format(str, sizeof(str), "You just got some more Candy! Use /candy to see your Candy Supply!");
    SendClientMessage(playerid, COLOR_RED, str);
	GetPlayerName(playerid,name,18);
	format(str, sizeof(str), "%s has just got some more Candy! Use /trickortreat at any Candy Checkpoint for some Candy!",name,playerid);
	SendClientMessageToAll(COLOR_RED,str);
 	SetTimerEx("waittreat", 10000, false, "d", playerid);
 	trickortreat[playerid] = false;
 	PlayerInfo[playerid][TreatAmount] = PlayerInfo[playerid][TreatAmount] +100;
 	format(str, sizeof(str), "~r~Trick Or Treat!~n~~w~You have an extra 100 Candy Now!");
 	GameTextForPlayer(playerid, str ,4000,5);
    return 1;
}
public waittreat(playerid)
{
    waittrickortreat[playerid] = false;
    return 1;
}
here ya go


Re: Why isnt this working more me now? - <Weponz> - 01.11.2010

*FACEPALM*

Sometimes i think why i even bother xD


Thanks!