SA-MP Forums Archive
Rather simple question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Rather simple question (/showthread.php?tid=249251)



Rather simple question - Andregood - 17.04.2011

I'm currently in need of help finishing this snippet, I'm not sure if I am doing it right at all, feel free to help! Thanks.



Код:
       command(vampirebite, playerid, params[])
	{
	
    if(gTeam(pID)); == RACE_VAMPIRES)) return SendClientMessage(playerid, 0xAFAFAFAA, "You need to be a vampire to use this command");
    if sscanf(params, "ui", pID, tID) return SendClientMessage(playerid, 0xAFAFAFAA, "Usage : /vampirebite [playerid/name]");
	if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0xAFAFAFAA, "That player is currently not connected.");
	return SendClientMessage(playerid, 0xAFAFAFAA, "You've been bitten by %s");
	}



Re: Rather simple question - Andregood - 17.04.2011

Still in need of help, thanks.


Re: Rather simple question - Joe Staff - 17.04.2011

Quote:
Originally Posted by Andregood
Посмотреть сообщение
I'm currently in need of help finishing this snippet, I'm not sure if I am doing it right at all, feel free to help! Thanks.



Код:
    command(vampirebite, playerid, params[])
	{
	
    if(gTeam(playerid)); == RACE_VAMPIRES)) return SendClientMessage(playerid, 0xAFAFAFAA, "You need to be a vampire to use this command");
    if sscanf(params, "ui", pID, tID)) return SendClientMessage(playerid, 0xAFAFAFAA, "Usage : /vampirebite [playerid/name]");
	if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, 0xAFAFAFAA, "That player is currently not connected.");
	return SendClientMessage(playerid, 0xAFAFAFAA, "You've been bitten");
	}
Well you seem to have two parameters in your sscanf function but only using one of them, also your return message is being sent to playerid instead of pID


Re: Rather simple question - Andregood - 17.04.2011

I basically fixed what you said but I'm still getting around 4 errors, that's why I am asking for a correction of the snippet if you or anyone else got time, as I need an example to go after in the future as well.


Edited the code thingy in the main post.


Re: Rather simple question - Joe Staff - 17.04.2011

Tell is what errors you're getting


Re: Rather simple question - Andregood - 17.04.2011

Код:
D:\SAMP Server\gamemodes\Vampires.pwn(181) : error 017: undefined symbol "gTeam"
D:\SAMP Server\gamemodes\Vampires.pwn(181) : error 036: empty statement
D:\SAMP Server\gamemodes\Vampires.pwn(181) : error 029: invalid expression, assumed zero
D:\SAMP Server\gamemodes\Vampires.pwn(181) : fatal error 107: too many error messages on one line
Thanks between


Re: Rather simple question - Kenoja - 18.04.2011

Read the comments to know more about each line I've added it to. You have to define the "gTeam." I was unsure if you wanted them to loose some health or not.

PHP код:
CMD:vampirebite(playeridparams[]) {
    if(
gTeam(playerid) != RACE_VAMPIRES) return SendClientMessage(playerid0xAFAFAFAA"You need to be a vampire to use this command"); // Checks if the team is RACE_VAMPIRES. If not, it returns the message that you have to be one.
    
    
new pID// Self-explanatory
    
    
if(sscanf(params"u"pID)) return SendClientMessage(playerid0xAFAFAFAA"Usage : /vampirebite [playerid/name]"); 
    if(
pID == INVALID_PLAYER_ID) return SendClientMessage(playerid0xAFAFAFAA"That player is currently not connected."); // Checks whether the ID is valid/connected
    
    
return SendClientMessage(pID0xAFAFAFAA"You've been bitten"); //After all the checks are done, sends this message if they all are passed.




Re: Rather simple question - Andregood - 18.04.2011

Well I basically got it all implemented but it only says "you need to be a vampire to use this command" every time I try to use it even though I do /setrace Kirki 2 ( I've defined RACE_VAMPIRES to be 2= RACE_VAMPIRES 2) Would you know the reason for not working? Thanks.


Re: Rather simple question - Andregood - 18.04.2011

Still in need of help, both being adding help to the command and also if somebody knows, fixing the defining problem I previously stated.


Re: Rather simple question - Andregood - 18.04.2011

Bump