I Need Help
#1

Hello! I am new to PAWNO scripting and need help with my admin script.

The code is:
Код:
Code Removed
The last if statement should compare the two variables and carry out actions if the conditionals are true or false. But it does not do this! Can someone help?

Also, I have a pickup that gives a player a minigun. However when you pick it up, you get kicked. Can someone help with this too? [SOLVED by Chrillzen!]

Thanks,

Cody_Maverak
Reply
#2

You have a function in your script that kicks everybody with Miniguns, probably under OnPlayerUpdate.
Reply
#3

Okay thank you Chrillzen. I did in fact have that in my game mode :P
Reply
#4

Here is the problem
pawn Код:
if (Password[] == actualPassword[])
The only time you use [] is if/when the variable is a string function parameter, or being defined as an array like this ( for example )
pawn Код:
stock YourFunction( playerid , inputtext[] )

//or

new brown[] = { 34 , 45 , 0 , 6 };
You are trying to compare the password with the players input, so you could use strcmp
pawn Код:
if( !strcmp( params , actualpassword , true ) )
another issue involving the command processor. Empty param strings will not trigger strlen, so the author has included a function to detect a lack of input from the player
pawn Код:
if( !strlen(params) )

//should be

if( isnull(params) )

Also, another small issue, you have an input string 256 long, the maximum number of characters in the chatbox is around 128.

anyway good luck.
Reply
#5

Quote:
Originally Posted by Rachael
Посмотреть сообщение
Here is the problem
pawn Код:
if (Password[] == actualPassword[])
The only time you use [] is if/when the variable is a string function parameter, or being defined as an array like this ( for example )
pawn Код:
stock YourFunction( playerid , inputtext[] )

//or

new brown[] = { 34 , 45 , 0 , 6 };
You are trying to compare the password with the players input, so you could use strcmp
pawn Код:
if( !strcmp( params , actualpassword , true ) )
another issue involving the command processor. Empty param strings will not trigger strlen, so the author has included a function to detect a lack of input from the player
pawn Код:
if( !strlen(params) )

//should be

if( isnull(params) )

Also, another small issue, you have an input string 256 long, the maximum number of characters in the chatbox is around 128.

anyway good luck.
Is isnull already defined? Or how to define it?

Thanks in advance
Reply
#6

sorry, disregard that part of my previous post, I thought you were using zcmd.
You should be able to see if strlen works with dcmd.
Reply
#7

But doesn't this already check if it is empty or not:
Код:
if(!strlen(params)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /login [Password]");
Anyway, Racheal, you were right with the strcmp. It works!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)