28.03.2015, 06:41
So i've just started learning to script few days ago. Made some IRC commands, but some of them are not working so i posted here to see if i could learn anything.
This is my script:
The sethealth command shows messages in-game, but doesn't set the player health to the specific amount.
The getinfo command is working fine, there's just some warning that's bothering me
The force command can't be compiled, idk what's wrong there :l
this is the error messages:
Also, i need explanation about commands... i mean like "/sethealth 0 3" , i want to know how can i assign 0 as the player ID, and the 3 as amount. The thing i did in my command was just copy, paste, and edit :l (or easiest way to create a command)
This is my script:
Код:
IRCCMD:sethealth(botid, channel[], user[], host[], params[]) { if (IRC_IsVoice(botid, channel, user)) { new tmp[64], playerid, amount; //Line 477 if (sscanf(params, "dS(Insert Amount)[64]", playerid, amount)) { return 1; } if (IsPlayerConnected(playerid)) { new msg[128], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(msg, sizeof(msg), "%s has set %s health to %s", user, name, amount); IRC_GroupSay(groupID, channel, msg); format(msg,sizeof(msg), "%s has set %s health to %s", user, name, amount); SendClientMessageToAll(0xDDDD2357, msg); SetPlayerHealth(playerid, amount); //Maybe Correct EDIT: Not working } } return 1; } IRCCMD:getinfo(botid, channel[], user[], host[], params[]) { if (IRC_IsVoice(botid, channel, user)) { new msg[128], playerid ; if (sscanf(params, "d", playerid)) return 1; if (!IsPlayerConnected(playerid)) return 1; format(msg, sizeof(msg), "Name: %s | IP: %s | Score: %d | Ping: %i | Health: %i | Armour: %i ", GetPlayerName(playerid), GetPlayerIp(playerid), //Line 508 GetPlayerScore(playerid), GetPlayerPing(playerid), GetPlayerHealth(playerid), GetPlayerArmour(playerid)); IRC_GroupSay(groupID, channel, msg); } return 1; } IRCCMD:force(botid, channel[], user[], host[], params[]) { if (IRC_IsVoice(botid, channel, user)) { new tmp[64], playerid, reason; if (!IsPlayerConnected(playerid) { new msg[128]; format(msg, sizeof(msg), "%s has been forced to go into class selection screen by admin %s | Reason: %s" playerid, user, reason); //Line 521 IRC_GroupSay(groupID, channel, msg); SendClientMessageToAll(0xDDDD2357, msg); ForceClassSelection(playerid); } } return 1; }
The getinfo command is working fine, there's just some warning that's bothering me
The force command can't be compiled, idk what's wrong there :l
this is the error messages:
Код:
E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(477) : warning 204: symbol is assigned a value that is never used: "tmp" E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(508) : warning 202: number of arguments does not match definition E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(508) : warning 202: number of arguments does not match definition E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(508) : warning 202: number of arguments does not match definition E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(508) : warning 202: number of arguments does not match definition E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(508 -- 509) : warning 202: number of arguments does not match definition E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(508 -- 509) : warning 202: number of arguments does not match definition E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(520) : error 001: expected token: ")", but found "{" E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(522) : error 001: expected token: "-string end-", but found "-identifier-" E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(522) : warning 215: expression has no effect E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(522) : warning 215: expression has no effect E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(522) : warning 215: expression has no effect E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(522) : error 001: expected token: ";", but found ")" E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(522) : error 029: invalid expression, assumed zero E:\Samp Server\SAMP SERVER\filterscripts\irc.pwn(522) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors.