PDA

View Full Version : Smail help +Rep


astanalol
22/12/2014, 11:56 PM
Hello Guys :)
i Want Know How To Make This Script For Rank 2 To rank 8 can use it
if(PlayerInfo[playerid][pRank] == 2)
{
its will be like this or what cuz i try it not working :) in Server
if(PlayerInfo[playerid][pRank] == 2.8)
{
:) i want know please 2 to 8
2 /3 /4 /5 /6 /7 /8
:))))))))))))))

UltraScripter
23/12/2014, 12:13 AM
if(PlayerInfo[playerid][pRank] => 2) if(PlayerInfo[playerid][pRank] =< 8)
{

}

astanalol
23/12/2014, 12:14 AM
This Will Use it 3 and 4 and 5 and 6 and 7 and 8 ?

UltraScripter
23/12/2014, 12:15 AM
yeah

astanalol
23/12/2014, 12:18 AM
Thanks :)

UltraScripter
23/12/2014, 12:19 AM
happy to help bro :)!.

astanalol
23/12/2014, 12:26 AM
sorry but when i make it in 2 commands differnts and compile i get error from frist one :(
any idea to make it 2 to 8 with not this ?
D:\ffff\gamemodes\fast.pwn(1299) : warning 211: possibly unintended assignment
D:\ffff\gamemodes\fast.pwn(1299) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1299) : warning 215: expression has no effect
D:\ffff\gamemodes\fast.pwn(1299) : error 001: expected token: ";", but found ")"
D:\ffff\gamemodes\fast.pwn(1299) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1299) : fatal error 107: too many error messages on one line
ling 1299
if(PlayerInfo[playerid][pRank] => 7) if(PlayerInfo[playerid][pRank] =< 8)
all cmds
CMD:setrank(playerid, params[])
{
new str[128], ARank, lookupid;
if(PlayerInfo[playerid][pRank] => 7) if(PlayerInfo[playerid][pRank] =< 8)
{
if(sscanf(params, "ui", lookupid, ARank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, ARank);
SendClientMessageToAll(-1, str);
PlayerInfo[lookupid][pRank] = ARank;
}
} else SendClientMessage(playerid, -1, "Sorry , you are not admin");
return 1;
}
i have CMD Again but not error :)

UltraScripter
23/12/2014, 12:30 AM
if(PlayerInfo[playerid][pRank] => 7) || if(PlayerInfo[playerid][pRank] =<7)

Sew_Sumi
23/12/2014, 12:39 AM
happy to help bro :)!.

How come you claim to be UltraScripter, yet can't use && ?

1fret
23/12/2014, 12:40 AM
You can try this

if(PlayerInfo[playerid][pRank] >= 2)

UltraScripter
23/12/2014, 12:42 AM
but he want to make it levles 2-8 only!

astanalol
23/12/2014, 12:42 AM
still not working
D:\ffff\gamemodes\fast.pwn(1299) : warning 211: possibly unintended assignment
D:\ffff\gamemodes\fast.pwn(1299) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1299) : warning 215: expression has no effect
D:\ffff\gamemodes\fast.pwn(1299) : error 001: expected token: ";", but found ")"
D:\ffff\gamemodes\fast.pwn(1299) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1299) : fatal error 107: too many error messages on one line
line 1299
if(PlayerInfo[playerid][pRank] => 7) || if(PlayerInfo[playerid][pRank] =<8)
{
all cmds
CMD:setrank(playerid, params[])
{
new str[128], ARank, lookupid;
if(PlayerInfo[playerid][pRank] => 7) || if(PlayerInfo[playerid][pRank] =<8)
{
if(sscanf(params, "ui", lookupid, ARank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, ARank);
SendClientMessageToAll(-1, str);
PlayerInfo[lookupid][pRank] = ARank;
}
} else SendClientMessage(playerid, -1, "Sorry , you are not admin");
return 1;
}

1fret
23/12/2014, 12:46 AM
@ ultrascripter that's what I use for a simular system and it works.

Try it

Sew_Sumi
23/12/2014, 12:48 AM
still not working

line 1299

all cmds

His code is wrong, that's why....

but he want to make it levles 2-8 only!

Then use <=8 && >=2 then...


Sheesh... And here you are going around the forums posting up code for +reps, yet still can't use operators efficiently???

Use


if(PlayerInfo[playerid][pRank] => 7 && PlayerInfo[playerid][pRank] =< 8 )


This is why simply pasting up code for +rep SUCKS...

UltraScripter
23/12/2014, 12:50 AM
you can use || too

1fret
23/12/2014, 12:52 AM
still not working

line 1299

all cmds

but he want to make it levles 2-8 only!

His code is wrong, that's why....



Then use <=8 && >=2 then...


Sheesh... And here you are going around the forums posting up code for +reps, yet still can't use operators efficiently???

Use


if(PlayerInfo[playerid][pRank] => 7 && PlayerInfo[playerid][pRank] =< 8 )


This is why simply pasting up code for +rep SUCKS...

All of our suggestion a right dude , but he say it didn't work so I suggested something different.

Sew_Sumi
23/12/2014, 12:53 AM
you can use || too

That's alright if you want to have bugs turn up later...


That will be true, if ANY of the 2 values are correct...

&& Requires BOTH to be true...



Do you see the difference, or you still can't see the point?

&& = AND, || = OR... BIG difference...

astanalol
23/12/2014, 12:55 AM
new errors in it again
D:\ffff\gamemodes\fast.pwn(1299) : warning 211: possibly unintended assignment
D:\ffff\gamemodes\fast.pwn(1299) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1299) : error 022: must be lvalue (non-constant)
D:\ffff\gamemodes\fast.pwn(1299) : error 029: invalid expression, assumed zero
D:\ffff\gamemodes\fast.pwn(1299) : fatal error 107: too many error messages on one line
if(PlayerInfo[playerid][pRank] => 7 && PlayerInfo[playerid][pRank] =< 8 )

UltraScripter
23/12/2014, 12:57 AM
yeah ok...

1fret
23/12/2014, 12:59 AM
if(PlayerInfo[playerid][pRank] >= 2) try this man. It wll only work for level two and higher.

Sew_Sumi
23/12/2014, 12:59 AM
new errors in it again


if(PlayerInfo[playerid][pRank] >= 7 && PlayerInfo[playerid][pRank] =< 8 )

Change that, it was => when it should've been >=.


yeah ok...

if(PlayerInfo[playerid][pRank] >= 2) try this man. It wll only work for level two and higher.

Please tell me you haven't repped these fools already...

JuanStone
23/12/2014, 01:00 AM
if(PlayerInfo[playerid][pRank] >= 2 && PlayerInfo[playerid][pRank] < 9)
{
// codes
}
else
{
SendClientMessage(playerid, -1, "You ate not prank 2-8.");
}

Using to 2-8.

Sew_Sumi
23/12/2014, 01:01 AM
if(PlayerInfo[playerid][pRank] >= 2 && PlayerInfo[playeri][pRank] < 9)

Use the <= for a definitive "hit" on the right value...

Abagail
23/12/2014, 01:02 AM
JuanStone, indeeds shows the correct way of doing this. Let me explain what using || will do:

- It will allow if there rank is higher than 2.
- It will allow if there rank is lower than 9.

He wants it to just be 2-8, not 2+ and lower than 9.

Sew_Sumi
23/12/2014, 01:26 AM
JuanStone, indeeds shows the correct way of doing this. Let me explain what using || will do:

- It will allow if there rank is higher than 2.
- It will allow if there rank is lower than 9.

He wants it to just be 2-8, not 2+ and lower than 9.

If I threw in a level of 12 into the || formula, it's higher than 2 so it will confirm.....

Same with the lower than 9, It'll work no matter what with ||... lol...

Should also be =< 8 rather than <9 just to make it a definitive match.


Now where the heck is my +rep, and I sure as heck hope you haven't +reped anyone else in here in haste to get a pastable code-snippet to simply paste in...

Abagail
23/12/2014, 02:15 AM
I am pointing out the mistake; not something that works. And; REP really doesn't matter; after getting 15 it's just a number(thats really all it becomes).

Sew_Sumi
23/12/2014, 02:28 AM
I am pointing out the mistake; not something that works. And; REP really doesn't matter; after getting 15 it's just a number(thats really all it becomes).

The fact that people with rep make this plain out simple mistake shows rep is given where it's not deserved...


Especially when it's pasted as code for someone to copy and paste into their buggy script, only for it to turn up again later when they ask about another bug.



And yet they're simply +repping for what? A fix with an inherent problem, and because they didn't make the script, when it bugs out noticably, they come back, and make another "help" thread.

ZachKnoxx
23/12/2014, 02:58 AM
deleted

astanalol
23/12/2014, 10:50 AM
Guys What now not any code fixed it :(
please help!

biker122
23/12/2014, 11:08 AM
if(PlayerInfo[playerid][pRank] >= 2 && PlayerInfo[playerid][pRank] <= 8)
{

astanalol
23/12/2014, 11:25 AM
[pawn]
if(PlayerInfo[playerid][pRank] >= 2 && PlayerInfo[playerid][pRank] <= 8)
{
[QUOTE]D:\ffff\gamemodes\fast.pwn(1306) : warning 209: function "cmd_setrank" should return a value
D:\ffff\gamemodes\fast.pwn(1306) : error 010: invalid function or declaration
D:\ffff\gamemodes\fast.pwn(1307) : error 010: invalid function or declaration
this line 1306 and 1307
} else SendClientMessage(playerid, -1, "Sorry , you are not admin");
return 1;

all cmd
CMD:setrank(playerid, params[])
{
new str[128], ARank, lookupid;
if(PlayerInfo[playerid][pRank] >= 2 && PlayerInfo[playerid][pRank] <= 8)
{
if(sscanf(params, "ui", lookupid, ARank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, ARank);
SendClientMessageToAll(-1, str);
PlayerInfo[lookupid][pRank] = ARank;
}
} else SendClientMessage(playerid, -1, "Sorry , you are not admin");
return 1;
}

Kaperstone
23/12/2014, 11:33 AM
if(PlayerInfo[playerid][pRank] => 2) if(PlayerInfo[playerid][pRank] =< 8)
{

}

This is not how you add checks
if(PlayerInfo[playerid][pRank] => 2 && PlayerInfo[playerid][pRank] =< 8) {}
To have two or more checks you just need to add the conditional statement inside the brackets () and seperate each with OR or AND gates.

AND gate is &&
OR gate is ||



this line 1306 and 1307
} else SendClientMessage(playerid, -1, "Sorry , you are not admin");
return 1;

all cmd
CMD:setrank(playerid, params[])
{
new str[128], ARank, lookupid;
if(PlayerInfo[playerid][pRank] >= 2 && PlayerInfo[playerid][pRank] <= 8)
{
if(sscanf(params, "ui", lookupid, ARank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, ARank);
SendClientMessageToAll(-1, str);
PlayerInfo[lookupid][pRank] = ARank;
}
} else SendClientMessage(playerid, -1, "Sorry , you are not admin");
return 1;
}
You have extra closing bracket }

astanalol
23/12/2014, 11:45 AM
i dont know what u mean

Kaperstone
23/12/2014, 11:55 AM
i dont know what u mean
In scripting and programming you open events with curely brackets {}
and between them you type what will happen when the statement will happen.
before the brackets you write the statement itself.
So for example
new foo =1; // We create the array and set it to 1.
if(foo==1) { // Here we create the statement, IF(something) { do this }else{ if it doesn't happen do this}
// so we check if array equal to 1 and then we open the event with open bracket {
SetPlayerName(playerid, "astanalol");
// Lets say, when array "foo" is equal to 1, we set his name to "astanalol"
// to close the event, so the compiler understand that this is all what we want to do
// we add } at the end of the code
}

Now, when I said "extra }" I meant you added a closing bracket } which has no job, you already closed the event, so it just stands there.

And so the compiler triggers these errors.
To fix this, you will need to remove that "extra" closing bracket.

biker122
23/12/2014, 12:25 PM
CMD:setrank(playerid, params[])
{
new str[128], ARank, lookupid;
if(PlayerInfo[playerid][pRank] >= 2 && PlayerInfo[playerid][pRank] <= 8)
{
if(sscanf(params, "ui", lookupid, ARank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, ARank);
SendClientMessageToAll(-1, str);
PlayerInfo[lookupid][pRank] = ARank;
}
else SendClientMessage(playerid, -1, "Sorry , you are not admin");
return 1;
}

Ox1gEN
23/12/2014, 12:29 PM
you can use || too

No, you can't. Why?

Because || is bassicly 'or'.

It bassicly says, if 'this statement' /OR/ 'this statement' is true, proceed.
Else-.. Do whatever you want.

And && is bassicly 'AND', if 'this statement' /AND/ 'this statement' are true, proceed.
Else-.. Do whatever you want.

And if he would've used || it would've been if the player's rank is 8<= or >= 2 proceed.
And if you used && it would've check if the player's rank is inbetween 2 and 8.
Therefore you can't use ||, techincally you can but it isn't what he wants.

AndySedeyn
23/12/2014, 12:32 PM
OR gate is &&
AND gate is ||


Wrong.
The controle structure for OR is: ||
The controle structure for AND is: &&


new foo =1; // We create the array and set it to 1.


That's a plain simple integer.

Ox1gEN
23/12/2014, 12:33 PM
Wrong.
The controle structure for OR is: ||
The controle structure for AND is: &&



That's a plain simple integer.

I've also noticed his mistakes but it's probably because he wrote alot and got confused or something.
He seem to know what's what though I believe.

Glossy42O
23/12/2014, 12:33 PM
CMD:setrank(playerid, params[])
{
new str[128], ARank, lookupid;
if(PlayerInfo[playerid][pRank] >= 2 && PlayerInfo[playerid][pRank] <= 8)
{
if(sscanf(params, "ui", lookupid, ARank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, ARank);
SendClientMessageToAll(-1, str);
PlayerInfo[lookupid][pRank] = ARank;
}
else SendClientMessage(playerid, -1, "Sorry , you are not admin");
return 1;
}

Kaperstone
23/12/2014, 01:00 PM
Wrong.
The controle structure for OR is: ||
The controle structure for AND is: &&

Fixed ;)
That's a plain simple integer.
So ?

astanalol
23/12/2014, 01:25 PM
CMD:setrank(playerid, params[])
{
new str[128], ARank, lookupid;
if(PlayerInfo[playerid][pRank] >= 2 && PlayerInfo[playerid][pRank] <= 8)
{
if(sscanf(params, "ui", lookupid, ARank)) return SendClientMessage(playerid, -1, "Usage: /setrank <PlayerID/PlayerName> <Rank>");
format(str, sizeof(str), "Admin %s (ID:%d) has setted %s (ID:%d) Rank to (%d)",GetName(playerid), playerid, GetName(lookupid), lookupid, ARank);
SendClientMessageToAll(-1, str);
PlayerInfo[lookupid][pRank] = ARank;
}
else SendClientMessage(playerid, -1, "Sorry , you are not admin");
return 1;
}
Fixed Alot Of Thanks :)
+Rep :)

astanalol
23/12/2014, 01:27 PM
Fixed ;)

So ?

and u too :) +rep for try Hard with me :)
thx

Sew_Sumi
23/12/2014, 02:22 PM
And this is why copying and pasting code to people isn't good... Even with the answers right in front of him on the console, he still wouldn't debug his own code, simply pasting it here expecting, yet again, for someone to fix it........

zT KiNgKoNg
23/12/2014, 02:35 PM
you can use || too

What your suggesting Sew_Sumi wouldn't work seen as the system would get confused and thing the "Client" has two values set to their Admin rank, but UltraScripter did give a correct solution is is a much better scripter than you Sew_Sumi seen as you've given something as a 'solution' that wouldn't work out-right.


Example:

if(AccountInformation[playerid][AccountAdminRank] >= 1 || AccountInformation[playerid][AccountHelperRank] >= 1)

Write
23/12/2014, 03:20 PM
It goes like this.

if (variable >= 1 && variable <= 8 )

Sew_Sumi
23/12/2014, 09:46 PM
What your suggesting Sew_Sumi wouldn't work seen as the system would get confused and thing the "Client" has two values set to their Admin rank, but UltraScripter did give a correct solution is is a much better scripter than you Sew_Sumi seen as you've given something as a 'solution' that wouldn't work out-right.


Example:

if(AccountInformation[playerid][AccountAdminRank] >= 1 || AccountInformation[playerid][AccountHelperRank] >= 1)


LOL, Go back to reading the damn guide then... I'm correct and what I've stated all along is true...

If you can't understand >= and <= then you obviously have no capability to be judging who is the better scripter, not that it's a fucking challenge... Not that you, or UltraScripter would be much challenge, fact is, that you both obviously don't understand Pawn in the slightest.

Rather than having one "hit", I'd prefer 2, to be "sure" that I'm getting the right value... If you prefer to use ||, then go ahead, but don't cry when the results fuck up on you...

As for the confused system, you're talking out your ass, and as for UltraScripter being a better scripter, ROFL......... Just last month "Ultra Scripter" was inserting Else statements where ever the fuck he liked without even making the required opening if statements...

But that's alright though, obviously you know how good he can script by the fact that he put 2 if statements on one line earlier on in the thread...



So where's your scripting examples mate... STFU and GTFO...


It goes like this.

if (variable >= 1 && variable <= 8 )

Exactly....



And with that, this thread, can be closed...