/GiveRpp
#1

Hola quiero poner en mi server rol un comando para que de RolePlay Points, pero tengo errores con la id al que se le va a dar el Punto. Por eso nececitaria ayuda de ustedes.

Tengo la base, pero nececito el final digamos jaja.

Код:
if(strcmp(cmdtext, "/giverpp", true) == 0)
{
    if(PlayerInfo[playerid][Level] >= 3)
    {
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
		    new tmp2[256], Index, player1;
		    tmp2 = strtok(params,Index)
		    player1 = strval(tmp);
		    
    		CMDMessageToAdmins(playerid,"GIVERPP");
			PlayerData[player1][Rpp] = +1;
			format(string, sizeof(string), "You have given a Roleplay Point To %s.", PlayerName2(player1);
			SendClientMessage(playerid,yellow,string);
        	if(player1 != playerid)
				{
				format(string,sizeof(string),"Administrator \"%s\" has given you a Roleplay Point", PlayerName2(playerid);
				SendClientMessage(player1,yellow,string);
   				PlayerData[playerid][Rpp] = +1;
	    		}
  		} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
  	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
	return 1;
}
Reply
#2

que errores te da?
talvez te funcione asi:
pawn Код:
if(strcmp(cmdtext, "/giverpp", true) == 0)
{
    if(PlayerInfo[playerid][Level] >= 3)
    {
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
        {
            new tmp2[256], Index, player1;
            tmp2 = strtok(params,Index)
            player1 = strval(tmp);
           
            CMDMessageToAdmins(playerid,"GIVERPP");
            PlayerData[player1][Rpp]++;
            format(string, sizeof(string), "You have given a Roleplay Point To %s.", PlayerName2(player1);
            SendClientMessage(playerid,yellow,string);
            if(player1 != playerid)
                {
                format(string,sizeof(string),"Administrator \"%s\" has given you a Roleplay Point", PlayerName2(playerid);
                SendClientMessage(player1,yellow,string);
                PlayerData[playerid][Rpp]++;
                }
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    return 1;
}
Reply
#3

Luego de eso me aparece esto:


C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(436 : warning 204: symbol is assigned a value that is never used: "pDeaths"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4451) : warning 217: loose indentation
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4455) : error 017: undefined symbol "player1"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(445 : error 017: undefined symbol "params"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4462) : error 028: invalid subscript (not an array or too many subscripts): "PlayerData"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4462) : warning 215: expression has no effect
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4462) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4462) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4462) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.
Reply
#4

pawn Код:
dcmd_giverpp(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 3)
    {
        new tmp2[256], Index, player1;
        tmp = strtok(params,Index)
        player1 = strval(tmp);
        if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /giverpp [playerid]");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
        {
            CMDMessageToAdmins(playerid,"GIVERPP");
            PlayerData[player1][Rpp]++;
            format(string, sizeof(string), "You have given a Roleplay Point To \"%s\"", PlayerName2(player1);
            SendClientMessage(playerid,yellow,string);
            if(player1 != playerid)
            {
                format(string,sizeof(string),"Administrator \"%s\" has given you a Roleplay Point", PlayerName2(playerid);
                SendClientMessage(player1,yellow,string);
                PlayerData[playerid][Rpp]++;
            }
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    return 1;
}
Reply
#5

Код:
4452. if(strcmp(cmdtext, "/giverpp", true) == 0)
   {
    if(PlayerInfo[playerid][Level] >= 3)
    {
        new tmp2[256], Index, player1;
        tmp = strtok(params,Index)
        player1 = strval(tmp);
        if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /giverpp [playerid]");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
        {
            CMDMessageToAdmins(playerid,"GIVERPP");
            PlayerData[player1][Rpp]++;
            format(string, sizeof(string), "You have given a Roleplay Point To \"%s\"", PlayerName2(player1);
            SendClientMessage(playerid,yellow,string);
            if(player1 != playerid)
            {
                format(string,sizeof(string),"Administrator \"%s\" has given you a Roleplay Point", PlayerName2(playerid);
                SendClientMessage(player1,yellow,string);
                PlayerData[playerid][Rpp]++;
            }
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
4474.     return 1;
4475. }
Lo pase asi, porque lo nececito asi

C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4369) : warning 204: symbol is assigned a value that is never used: "pDeaths"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4452) : warning 217: loose indentation
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4457) : error 017: undefined symbol "params"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4463) : error 028: invalid subscript (not an array or too many subscripts): "PlayerData"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4463) : warning 215: expression has no effect
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4463) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4463) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4463) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

Reply
#6

cambia esto:
pawn Код:
tmp = strtok(params,Index)
por
pawn Код:
tmp = strtok(cmd,Index)//o cmdtext
y cambia PlayerData por PlayerInfo
Reply
#7

Sigue esto:


C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4449) : warning 217: loose indentation
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4455) : error 001: expected token: ";", but found "-identifier-"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4460) : error 028: invalid subscript (not an array or too many subscripts): "PlayerData"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4460) : warning 215: expression has no effect
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4460) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4460) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4460) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#8

pawn Код:
if(!strcmp(cmd, "/giverpp", true))
{
    if(PlayerInfo[playerid][Level] >= 3)
    {
        new tmp2[256], Index, player1;
        tmp = strtok(cmdtext,idx)
        if(!strlen(tmp)) return SendClientMessage(playerid, yellow, "USAGE: /giverpp [playerid]");
        player1 = strval(tmp);
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
        {
            CMDMessageToAdmins(playerid,"GIVERPP");
            PlayerInfo[player1][Rpp]++;
            format(string, sizeof(string), "You have given a Roleplay Point To \"%s\"", PlayerName2(player1);
            SendClientMessage(playerid,yellow,string);
            if(player1 != playerid)
            {
                format(string,sizeof(string),"Administrator \"%s\" has given you a Roleplay Point", PlayerName2(playerid);
                SendClientMessage(player1,yellow,string);
                PlayerInfo[playerid][Rpp]++;
            }
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    return 1;
}
Reply
#9

Va mejor xd , pero sigue mal D:

C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4449) : warning 217: loose indentation
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4455) : error 001: expected token: ";", but found "if"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4461) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4465) : error 001: expected token: ",", but found ";"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4453) : warning 203: symbol is never used: "Index"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4453) : warning 204: symbol is assigned a value that is never used: "tmp2"
C:\Documents and Settings\Administrador\Escritorio\Servers\Server Gangster 0.3c\filterscripts\ladmin4v2.pwn(4474) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#10

pawn Код:
if(!strcmp(cmd, "/giverpp", true))
{
    if(PlayerInfo[playerid][Level] >= 3)
    {
        new tmp[256], player1;//el 'tmp2' no hacia funcion y el 'tmp' no estaba definido
        tmp = strtok(cmdtext,idx);//aqui no tenia el ';'
        if(!strlen(tmp)) return SendClientMessage(playerid, yellow, "USAGE: /giverpp [playerid]");
        player1 = strval(tmp);
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
        {
            CMDMessageToAdmins(playerid,"GIVERPP");
            PlayerInfo[player1][Rpp]++;
            format(string, sizeof(string), "You have given a Roleplay Point To \"%s\"", PlayerName2(player1));//aqui faltaba un ')'
            SendClientMessage(playerid,yellow,string);
            if(player1 != playerid)
            {
                format(string,sizeof(string),"Administrator \"%s\" has given you a Roleplay Point", PlayerName2(playerid));//aqui tambien un ')'
                SendClientMessage(player1,yellow,string);
                PlayerInfo[playerid][Rpp]++;
            }
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    return 1;
}
1. usa "[CODE*] [/CODE*]" sin el '*' para los errores
2. Pasa las lineas de los errores
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)