Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   hehehehe (https://forums.graalonline.com/forums/showthread.php?t=13369)

Metal-Slug 09-30-2001 04:30 AM

hehehehe
 
im trying to make it so that if i say die <account> without the <>'s it will kill that account, i have no idea how to start this, i was just wondering if someone could tell me how or post it

oscarjf1 09-30-2001 04:36 AM

umm
 
i think it would be along the lines of
NPC Code:

tokenize #c;
if (strequals(#t(0),die)) {
with (getplayer(#t(1))) {playerhearts-=20;
}
}



That SHOULD work...i dont know if it will.

entravial 09-30-2001 04:37 AM

~AlphaFlame~

First of all, you need to make an NPC that saves the account name to a server.string.

Then, you need to make a system NPC that kills the player if the server.string is equal to their account name.

And that's that.

[edit]P.S. - for Non-P2P[/edit]

Metal-Slug 09-30-2001 06:52 AM

how i make it work?

btedji 09-30-2001 06:55 AM

thats hilarious, just dont give that to people you dont trust!!!

btedji 10-01-2001 08:51 AM

you can do that with non-p2p it just would be laggier

nyghtGT 10-01-2001 09:03 AM

Re: hehehehe
 
Quote:

Originally posted by Metal-Slug
im trying to make it so that if i say die <account> without the <>'s it will kill that account, i have no idea how to start this, i was just wondering if someone could tell me how or post it
uhh youw would have to have it were the player who was being killed would have an NPC and the person who wants him dead having a NPC and here is what it would be:

NPC Code:

Killer:
if (created) {
toweapons Kill Other Player;
}
if (playerchats && startswith(die)) {
if (hasweapon(Kill Other PLayer)) {
tokenize #c;
setstring server.kill,#t(1);
}
}

Victim:
if (strequals(#a,#s,server.kill)) {
playerhearts=0;
setstring server.kill, ;
}


That would work ... (i think)

btedji 10-01-2001 09:07 AM

Re: Re: hehehehe
 
Quote:

Originally posted by nyghtGT

That would work ... (i think)

yes that would work

ArmadeusWarlock 10-01-2001 09:13 AM

Aha, very well that would work. And what about those with a space in their acct? like, for example:
Account:Stefan Dude
Stefan and dude are two different words, and with tokens, you only did token 1, which is the 2nd word. its best to use #e. Here is an example:

NPC Code:

//Killer
if(created){
toweapons Killer;
}
if(isweapon&&playerchats&&startswith(kill player)){
setstring server.tobekilled,#e(12,-1,#c);
}
//Victim
if(strequals(#a,strtofloat(server.tobekilled))){
playerhearts-=20;
setstring server.tobekilled,;
}



I dont have graal on this comp so Im not ENTIRELY sure that would work, with the strequal part, i am having a brain cramp and cant remember how to do that :o, but you get the idea.

ArmadeusWarlock 10-01-2001 09:15 AM

Like when I warp people to survivor island, you have to put " " around those with more than 1 word in there account, but im not sure if that works with toekns =O
Oh well, Im confused enough =(

btedji 10-01-2001 09:16 AM

Quote:

Originally posted by ArmadeusWarlock
Aha, very well that would work. And what about those with a space in their acct? like, for example:
Account:Stefan Dude
Stefan and dude are two different words, and with tokens, you only did token 1, which is the 2nd word. its best to use #e. Here is an example:

NPC Code:

//Killer
if(created){
toweapons Killer;
}
if(isweapon&&playerchats&&startswith(kill player)){
setstring server.tobekilled,#e(12,-1,#c);
}
//Victim
if(strequals(#a,strtofloat(server.tobekilled))){
playerhearts-=20;
setstring server.tobekilled,;
}



I dont have graal on this comp so Im not ENTIRELY sure that would work, with the strequal part, i am having a brain cramp and cant remember how to do that :o, but you get the idea.

if the numbers are right in the #e() then it would work

btedji 10-01-2001 07:26 PM

Quote:

Originally posted by Kaimetsu


But it wouldn't. He's using strtofloat on a string containing non-numeric data. Don't ask me why...

it should be #s()

toad1413 10-01-2001 07:40 PM

Quote:

Originally posted by btedji


it should be #s()

Still wouldn't work. He's using strtofloat on it... Strtofloat is or numeric data, for data with decimals really.

nyghtGT 10-02-2001 05:22 PM

maybe
 
Quote:

Originally posted by ArmadeusWarlock
Aha, very well that would work. And what about those with a space in their acct? like, for example:
Account:Stefan Dude
Stefan and dude are two different words, and with tokens, you only did token 1, which is the 2nd word. its best to use #e. Here is an example:

NPC Code:

//Killer
if(created){
toweapons Killer;
}
if(isweapon&&playerchats&&startswith(kill player)){
setstring server.tobekilled,#e(12,-1,#c);
}
//Victim
if(strequals(#a,strtofloat(server.tobekilled))){
playerhearts-=20;
setstring server.tobekilled,;
}



I dont have graal on this comp so Im not ENTIRELY sure that would work, with the strequal part, i am having a brain cramp and cant remember how to do that :o, but you get the idea.

easy just use 'if (tokenscount)'
NPC Code:

Killer:
if (created) {
toweapons Kill Other Player;
}
if (playerchats && startswith(die)) {
if (hasweapon(Kill Other PLayer)) {
tokenize #c;
if (tokenscount=1) {
setstring server.kill,#t(1);
}
}
}else setstring server.kill,#t(1) #t(2);

Victim:
if (strequals(#a,#s,server.kill)) {
playerhearts=0;
setstring server.kill, ;
}


just guessing but that could work ..... (i think)

btedji 10-02-2001 07:15 PM

if you use the previous method, it would work with spaces in the name too


All times are GMT +2. The time now is 10:02 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.