PDA

View Full Version : undefined symbol "PlayerInfo"


DGRP
22/01/2015, 01:29 PM
When I try to compile this:
#define FILTERSCRIPT


// DJ Script by ZombieNest
// Thanks to BC-RP for the stream code


#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <foreach>


#define COLOR_LIGHTRED 0xAA3333AA


public OnFilterScriptInit()
{
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ");
print(" <><><><>DJ Filterscript Loaded by ZombieNest<><><><><><><><><> ");
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>\n");
return 1;
}

public OnFilterScriptExit()
{
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ");
print(" <><><><>DJ Filterscript Unloaded by ZombieNest<><><><><><><><><> ");
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>\n");
return 1;
}

// For the stream thing thanks to BcRp by bustern
CMD:dj(playerid, params[])
{
new string[128];
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, -1, "[Usage]: /dj [url/help/stop/credits]");
if(!strcmp(params, "help", true, 4))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "{0033FF}DJ Help:{FAD008}DJ is a system for players to play songs offically.");
SendClientMessage(playerid, COLOR_LIGHTRED, "{0033FF}DJ Help:{FAD008}All players will be able to hear the song. Not only you!");
return 1;
}
if(!strcmp(params, "stop", true, 4))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "{0033FF}DJ Stopped.");
StopAudioStreamForPlayer(playerid);
return 1;
}
if(!strcmp(params, "credits", true, 4))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Thanks to:");
SendClientMessage(playerid, -1, "{0033FF}Bustern for the Stream system");
SendClientMessage(playerid, -1, "{FAD009}Kevin Hendrews a.k.a ZombieNest for editing");
return 1;
}
if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
format(string, sizeof(string), "{FFFFFF}>> {0033FF}[DJ]{FFFFFF}: A Player is now DJing {FAD008} ( /dj help for more)");
SendClientMessageToAll(0xFFFFFFAA,string);
foreach(Player, i)
{
PlayAudioStreamForPlayer(i, params);
}
return 1;
}

And the ORIGINAL one is this:
#define FILTERSCRIPT


// DJ Script by ZombieNest
// Thanks to BC-RP for the stream code


#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <foreach>


#define COLOR_LIGHTRED 0xAA3333AA


public OnFilterScriptInit()
{
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ");
print(" <><><><>DJ Filterscript Loaded by ZombieNest<><><><><><><><><> ");
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>\n");
return 1;
}

public OnFilterScriptExit()
{
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ");
print(" <><><><>DJ Filterscript Unloaded by ZombieNest<><><><><><><><><> ");
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>\n");
return 1;
}

// For the stream thing thanks to BcRp by bustern
CMD:dj(playerid, params[])
{
new string[128];
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, -1, "[Usage]: /dj [url/help/stop/credits]");
if(!strcmp(params, "help", true, 4))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "{0033FF}DJ Help:{FAD008}DJ is a system for players to play songs offically.");
SendClientMessage(playerid, COLOR_LIGHTRED, "{0033FF}DJ Help:{FAD008}All players will be able to hear the song. Not only you!");
return 1;
}
if(!strcmp(params, "stop", true, 4))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "{0033FF}DJ Stopped.");
StopAudioStreamForPlayer(playerid);
return 1;
}
if(!strcmp(params, "credits", true, 4))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Thanks to:");
SendClientMessage(playerid, -1, "{0033FF}Bustern for the Stream system");
SendClientMessage(playerid, -1, "{FAD009}Kevin Hendrews a.k.a ZombieNest for editing");
return 1;
}
//if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
format(string, sizeof(string), "{FFFFFF}>> {0033FF}[DJ]{FFFFFF}: A Player is now DJing {FAD008} ( /dj help for more)");
SendClientMessageToAll(0xFFFFFFAA,string);
foreach(Player, i)
{
PlayAudioStreamForPlayer(i, params);
}
return 1;
}

AND When I use the first code, I get this errors:
error 017: undefined symbol "PlayerInfo"
C:\Users\D\Desktop\dj.pwn(57) : warning 215: expression has no effect
C:\Users\D\Desktop\dj.pwn(57) : error 001: expected token: ";", but found "]"
C:\Users\D\Desktop\dj.pwn(57) : error 029: invalid expression, assumed zero
C:\Users\D\Desktop\dj.pwn(57) : fatal error 107: too many error messages on one line
Can anyone help me?

JJack
22/01/2015, 01:33 PM
Its because "playerid" isn't defined in that filterscript.
You should either define it or try to add that filterscript to your gamemode as [Admin] and many things arent defined.

DGRP
22/01/2015, 01:40 PM
How to define it, maybe, you can help me?

JJack
22/01/2015, 01:43 PM
How to define it, maybe, you can help me?
I think that you are using Raven's script GM. However, the defines are there. I really suggest you to make that command only for the ones who have /rcon logined instead of making it for admins that are 1337....'
Since defining them all would mess up. As I think that you wont be able to just add that FS to your GM( I mean copy-pasting it to your GM but that wont work since your commands are not using ZCMD)

DGRP
22/01/2015, 01:44 PM
Nah, not using raven's... I want only the admins can use them/Faction members.

Ironboy
22/01/2015, 01:48 PM
You have to create enum,

//example
enum pinfo
{
pAdmin,
score,
money;
};
new PlayerInfo[MAX_PLAYERS][pinfo];

DGRP
22/01/2015, 02:00 PM
Fixed, now how do I make it so only SANews can use the command?

#define FILTERSCRIPT


// DJ Script by ZombieNest
// Thanks to BC-RP for the stream code


#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <foreach>
#define COLOR_LIGHTRED 0xAA3333AA
#define COLOR_GREY 0xAFAFAFAA
enum pinfo
{
pAdmin,
score,
money,
pMember,
};
new PlayerInfo[MAX_PLAYERS][pinfo];

public OnFilterScriptInit()
{
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ");
print(" <><><><>DJ Filterscript Loaded by ZombieNest<><><><><><><><><> ");
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>\n");
return 1;
}

public OnFilterScriptExit()
{
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ");
print(" <><><><>DJ Filterscript Unloaded by ZombieNest<><><><><><><><><> ");
print("<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>\n");
return 1;
}

// For the stream thing thanks to BcRp by bustern
CMD:dj(playerid, params[])
{
new string[128];
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, -1, "[Usage]: /dj [url/help/stop/credits]");
if(!strcmp(params, "help", true, 4))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "{0033FF}DJ Help:{FAD008}DJ is a system for players to play songs offically.");
SendClientMessage(playerid, COLOR_LIGHTRED, "{0033FF}DJ Help:{FAD008}All players will be able to hear the song. Not only you!");
return 1;
}
if(!strcmp(params, "stop", true, 4))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "{0033FF}DJ Stopped.");
StopAudioStreamForPlayer(playerid);
return 1;
}
if(!strcmp(params, "credits", true, 4))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Thanks to:");
SendClientMessage(playerid, -1, "{0033FF}Bustern for the Stream system");
SendClientMessage(playerid, -1, "{FAD009}Kevin Hendrews a.k.a ZombieNest for editing");
return 1;
}
if(PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
format(string, sizeof(string), "{FFFFFF}>> {0033FF}[DJ]{FFFFFF}: A Player is now DJing {FAD008} ( /dj help for more)");
SendClientMessageToAll(0xFFFFFFAA,string);
foreach(Player, i)
{
PlayAudioStreamForPlayer(i, params);
}
return 1;
}


I added the pMember, in the ENUM

Ironboy
22/01/2015, 02:33 PM
When it comes to the end variable in the enum you're not supposed to put coma after it

enum pinfo
{
pAdmin,
score,
money,
pMember; // in this line you shouldn't put coma
};

dannyk0ed
22/01/2015, 03:18 PM
Nah, not using raven's... I want only the admins can use them/Faction members.
Make the command in the GM not in a filterscript, because your gamemode has the saving system and loading system in it(I hope) so it'll be easier to define the playerinfo.

DGRP
23/01/2015, 06:51 AM
pAdmin and pMember is already defined on the script, but when I add it to my script, it gives me error.
C:\Users\D\Desktop\SLRP1 - Copy.pwn(43229) : error 001: expected token: ")", but found "new"
C:\Users\D\Desktop\SLRP1 - Copy.pwn(43229) : error 003: declaration of a local variable must appear in a compound block
C:\Users\D\Desktop\SLRP1 - Copy.pwn(43229) : error 017: undefined symbol "string"
C:\Users\D\Desktop\SLRP1 - Copy.pwn(43229) : fatal error 107: too many error messages on one line

Sew_Sumi
23/01/2015, 07:36 AM
-Editted-
nvm

DGRP
23/01/2015, 07:57 AM
Help?

Ciarannn
23/01/2015, 09:16 AM
Help?

At the top of your script add:


#include <dini>

Sew_Sumi
23/01/2015, 01:29 PM
pAdmin and pMember is already defined on the script, but when I add it to my script, it gives me error.

defining pMember, and pAdmin, aren't the same as the enum...

Also


enum pinfo
{
pAdmin,
score,
money,
pMember
};

Just to be clear, you should have that.

And paste up your current error messages. Along with the corresponding lines.