PDA

View Full Version : Help with a command


yancarlos4500
18/07/2013, 02:45 AM
So i have
a inside game radio managment

which you can play music for other player while you are ingame

what i want is the if i am the owner of radio #1 and a player is listening to Radio #1
and i type /microfono1 (message) it will send a message to all player listening to radio #1


so this is what i was trying to do




if (strcmp("/Microfono1", cmdtext, true, 11) == 0)
{
if(strlen(cmdtext) <= 11)
{
SendClientMessage(playerid,0xC7C7C7FF,"USAGE: /microfono1 (message) - Enter A Valid Cop Message.");
return 1;
}
else
{
new output[255];
new string[128];
strmid(output,cmdtext,3,strlen(cmdtext));
format(string, sizeof(string), "[Locutor de Radio %d]: %s", Emisser[1],output);
for(new i = 0; i < MAX_PLAYERS; i++)
{
checkindex(playerid);
if(GetVar(playerid, "pvar1") == 1)
{
format(string, sizeof(string), "[Locutor de Radio %s]: %s",Emisser[1],output);
Microfono1(blue,string);
//SendClientMessage(i,blue,string);
return 1;
}
else
{
if(isnull(cmdtext)) return SendClientMessage(playerid,0xC7C7C7FF,"usted no es locutor de radio.");
SendClientMessage(playerid,0xC7C7C7FF,"usted no es locutor de radio.");
return 1;
}
}
}
}


forward Microfono1(color,const string[]);
public Microfono1(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new pvar1 = GetPVarInt(i,"pvar1");
if(IsPlayerConnected(i) == 1) if(pvar1==pvar1) SendClientMessage(i,color,string);
}
return 1;
}



Help Help Help please!!!

If you help me i will give you the filterscript (If you want)

Elie1996
18/07/2013, 08:20 AM
So what's your problem? and I don't really see a point of having all of those return 1 in your code. Your code is similar to this:



if(.....)
{
// do stuff
return 1;
}
else {
if(....)
{
//do stuff
return 1;
}


instead have it like this, it won't make a difference:



if(....)
{
// do stuff
}
else {
if(....)
{
// do stuff
}
return 1;


And not that I mean anything but you should use zcmd or ycmd, strcmp is an old method.
Good Day :D

yancarlos4500
18/07/2013, 02:36 PM
O wuao i didn't post the erros


C:\Users\Android\Desktop\Maclao Stuff\Android Roleplay\filterscripts\emisser.pwn(118) : error 017: undefined symbol "Emisser"
C:\Users\Android\Desktop\Maclao Stuff\Android Roleplay\filterscripts\emisser.pwn(118) : warning 215: expression has no effect
C:\Users\Android\Desktop\Maclao Stuff\Android Roleplay\filterscripts\emisser.pwn(118) : error 001: expected token: ";", but found "]"
C:\Users\Android\Desktop\Maclao Stuff\Android Roleplay\filterscripts\emisser.pwn(118) : error 029: invalid expression, assumed zero
C:\Users\Android\Desktop\Maclao Stuff\Android Roleplay\filterscripts\emisser.pwn(118) : fatal error 107: too many error messages on one line

Elie1996
18/07/2013, 05:57 PM
can you tell me which is line 118?

yancarlos4500
19/07/2013, 03:05 PM
format(string, sizeof(string), "[Locutor de Radio %d]: %s", Emisser[1],output);