SoundID Script
#1

i try to create sound id heared for all player .
this is my script , but not work
pawn Код:
CMD:Thank(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3) {
    PlayerPlaySound(playerid,5453,0.0,0.0,0.0);
    format(string,sizeof(string),"{dd0000}%s : Thank you sir have a nice day!", Name );
    SendClientMessageToAll(-1,string);
    return 1;
    } else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}
anyone can help me ?
Reply
#2

You need a loop:

pawn Код:
CMD:Thank(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
              {PlayerPlaySound(i,5453,0.0,0.0,0.0);}
        format(string,sizeof(string),"{dd0000}%s : Thank you sir have a nice day!", Name );
        SendClientMessageToAll(-1,string);
    }
    else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}
Reply
#3

thats the correct code if i understood well what did you mean


pawn Код:
CMD:Thank(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3) {
    for(new p = 0; p < MAX_PLAYERS; p++){
    if(!IsPlayerConnected(p)) continue;
    PlayerPlaySound(p,5453,0.0,0.0,0.0);
    }
    format(string,sizeof(string),"{dd0000}%s : Thank you sir have a nice day!", Name );
    SendClientMessageToAll(-1,string);
    return 1;
    } else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}
EDIT: you shall look at the poster above me
Reply
#4

wow thanks .
but i have problem , when i type /thank , eror showing
SERVER: Unknown command.
i add that script on filterscript
pawn Код:
#include <a_samp>

    public OnFilterScriptInit() {
    print("\n----------------------------------------------------");
    print(" SoundID System");
    print("----------------------------------------------------\n");
    return 1;
}

CMD:Thank(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
              {PlayerPlaySound(i,5453,0.0,0.0,0.0);}
        format(string,sizeof(string),"{dd0000}%s : Thank you sir have a nice day!", Name );
        SendClientMessageToAll(-1,string);
    }
    else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}
Reply
#5

Код:
CMD:Thank(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
              {PlayerPlaySound(i,5453,0.0,0.0,0.0);}
        format(string,sizeof(string),"{dd0000}%s : Thank you sir have a nice day!", Name );
        SendClientMessageToAll(-1,string);
    }
    else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
    return 1;
}
Reply
#6

but i have problem , when i type /thank , eror showing
SERVER: Unknown command.
i add that script on filterscript
pawn Код:
#include <a_samp>

    public OnFilterScriptInit() {
    print("\n----------------------------------------------------");
    print(" SoundID System");
    print("----------------------------------------------------\n");
    return 1;
}

CMD:Thank(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
              {PlayerPlaySound(i,5453,0.0,0.0,0.0);}
        format(string,sizeof(string),"{dd0000}%s : Thank you sir have a nice day!", Name );
        SendClientMessageToAll(-1,string);
    }
    else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}
Reply
#7

i think u forgot "return 1;" before closing the bracket.
Reply
#8

You forgot to add #include <zcmd>
Reply
#9

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
You forgot to add #include <zcmd>
this is my script
pawn Код:
#include <a_samp>
#include <zcmd>

    public OnFilterScriptInit() {
    print("\n----------------------------------------------------");
    print(" SoundID System");
    print("----------------------------------------------------\n");
    return 1;
}

CMD:Thank(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3)
    {
        for(new i=0;i<MAX_PLAYERS;i++)
              {PlayerPlaySound(i,5453,0.0,0.0,0.0);}
        format(string,sizeof(string),"{dd0000}%s : Thank you sir have a nice day!", Name );
        SendClientMessageToAll(-1,string);
        return 1;
    }
    else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}
and i have this eror on compile when i add #include <zcmd>
pawn Код:
C:\DOCUME~1\user\Desktop\Server\PARADI~1\FILTER~1\sound.pwn(20) : error 017: undefined symbol "PlayerInfo"
C:\DOCUME~1\user\Desktop\Server\PARADI~1\FILTER~1\sound.pwn(20) : warning 215: expression has no effect
C:\DOCUME~1\user\Desktop\Server\PARADI~1\FILTER~1\sound.pwn(20) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\user\Desktop\Server\PARADI~1\FILTER~1\sound.pwn(20) : error 029: invalid expression, assumed zero
C:\DOCUME~1\user\Desktop\Server\PARADI~1\FILTER~1\sound.pwn(20) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#10

this ?

pawn Код:
#include <a_samp>
#include <zcmd>

    public OnFilterScriptInit()
    print("\n----------------------------------------------------");
    print(" SoundID System");
    print("----------------------------------------------------\n");
    return 1;
}


CMD:Thank(playerid,params[])
{
    #pragma unused params
    for(new i=0;i<MAX_PLAYERS;i++)
    {
         new string[128];
         PlayerPlaySound(i,5453,0.0,0.0,0.0);
         new name[MAX_PLAYER_NAME+1];
         GetPlayerName(playerid, name, sizeof(name));
        format(string,sizeof(string),"{dd0000}%s : Thank you sir have a nice day!", name);
        SendClientMessageToAll(-1,string);
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)