SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 19/02/2011, 03:38 PM   #1
Zack9764
Huge Clucker
 
Zack9764's Avatar
 
Join Date: Jun 2008
Posts: 279
Reputation: 1
Default Set a variable to what they ask

Code:
           new station = strcmp(cmdtext);
	   if(RadioStatus[vehicleid] == 1)
	   {
		if(strcmp(station,"1",true) == 0)
		{
	      	        RadioChannel[vehicleid] = 1;
	      		SendClientMessage(vehicleid, COLOR_ORANGE,"Radio station set to number one");
	      		return 1;
      		}
           }
What am I doing wrong? I'm confused on how to do this.

Code:
error 035: argument type mismatch (argument 1)
__________________
Zack9764 is offline  
Old 19/02/2011, 03:44 PM   #2
Serbish
Gangsta
 
Join Date: Apr 2008
Posts: 606
Reputation: 31
Default Re: Set a variable to what they ask

So, you want it happens if you type in chat " 1 " ?
Serbish is offline  
Old 19/02/2011, 03:48 PM   #3
!Phoenix!
Big Clucker
 
Join Date: Feb 2011
Location: 127.0.0.1 - Germany
Posts: 81
Reputation: 0
Default AW: Set a variable to what they ask

Which line?
SendClientMessage I assume? (Only possible line here)

But why do you send a message to a vehicle?


//------------
Edit:
Check http://wiki.sa-mp.com/wiki/Strcmp
(Please always flag the line where the error occurs)
!Phoenix! is offline  
Old 19/02/2011, 04:22 PM   #4
Zack9764
Huge Clucker
 
Zack9764's Avatar
 
Join Date: Jun 2008
Posts: 279
Reputation: 1
Default Re: Set a variable to what they ask

Quote:
Originally Posted by Serbish View Post
So, you want it happens if you type in chat " 1 " ?
/Changestation 1

Code:
if(strcmp(cmd, "/changestation", true) == 0)
Is above it.

Quote:
Originally Posted by !Phoenix!
But why do you send a message to a vehicle?
Don't worry about it.

I'm getting the error on the strcmp line.
__________________
Zack9764 is offline  
Old 19/02/2011, 04:37 PM   #5
Serbish
Gangsta
 
Join Date: Apr 2008
Posts: 606
Reputation: 31
Default Re: Set a variable to what they ask

pawn Code:
// Top of the ' OnPlayerCommandText ' callback.

new cmd[128], tmp[128], idx;
cmd = strtok(cmdtext, idx);

// Under ' OnPlayerCommandText ' callback.

if(strcmp(cmd, "/changestation", true) == 0)
{
    new station;
    tmp = strtok(cmdtext, idx);
    station = strval(tmp);
    if(strlen(tmp))
    {
        if(IsNumeric(tmp))
        {
            if(station > 0 || station < 6) // Example: This makes you can choose between 1 - 5.
            {
                if(station == 1)
                {
                    RadioChannel[vehicleid] = 1;
                    SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number one.");
                    return 1;
                }
                else if(station == 2)
                {
                    RadioChannel[vehicleid] = 2;
                    SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number two.");
                    return 1;
                }
                else if(station == 3)
                {
                    RadioChannel[vehicleid] = 3;
                    SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number three.");
                    return 1;
                }
                else if(station == 4)
                {
                    RadioChannel[vehicleid] = 4;
                    SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number four.");
                    return 1;
                }
                else if(station == 5)
                {
                    RadioChannel[vehicleid] = 5;
                    SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number five.");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_ORANGE, "Choose a station number from 1 to 5.");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_ORANGE, "Invalid station number.");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_ORANGE, "Type: /changestation [1 - 5]");
        return 1;
    }
}
Serbish is offline  
Old 19/02/2011, 04:45 PM   #6
Zack9764
Huge Clucker
 
Zack9764's Avatar
 
Join Date: Jun 2008
Posts: 279
Reputation: 1
Default Re: Set a variable to what they ask

Quote:
Originally Posted by Serbish View Post
pawn Code:
// Top of the ' OnPlayerCommandText ' callback.

new cmd[128], tmp[128], idx;
cmd = strtok(cmdtext, idx);

// Under ' OnPlayerCommandText ' callback.

if(strcmp(cmd, "/changestation", true) == 0)
{
    new station;
    tmp = strtok(cmdtext, idx);
    station = strval(tmp);
    if(strlen(tmp))
    {
        if(IsNumeric(tmp))
        {
            if(station > 0 || station < 6) // Example: This makes you can choose between 1 - 5.
            {
                if(station == 1)
                {
                    RadioChannel[vehicleid] = 1;
                    SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number one.");
                    return 1;
                }
                else if(station == 2)
                {
                    RadioChannel[vehicleid] = 2;
                    SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number two.");
                    return 1;
                }
                else if(station == 3)
                {
                    RadioChannel[vehicleid] = 3;
                    SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number three.");
                    return 1;
                }
                else if(station == 4)
                {
                    RadioChannel[vehicleid] = 4;
                    SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number four.");
                    return 1;
                }
                else if(station == 5)
                {
                    RadioChannel[vehicleid] = 5;
                    SendClientMessage(vehicleid, COLOR_ORANGE, "Radio station set to number five.");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_ORANGE, "Choose a station number from 1 to 5.");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_ORANGE, "Invalid station number.");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_ORANGE, "Type: /changestation [1 - 5]");
        return 1;
    }
}
Can you also cure cancer for me?
__________________
Zack9764 is offline  
Old 19/02/2011, 04:49 PM   #7
Mean
High-roller
 
Join Date: Jul 2010
Location: 14th annual lemon party
Posts: 2,727
Reputation: 229
Default Re: Set a variable to what they ask

Quote:
Originally Posted by Zack9764 View Post
Can you also cure cancer for me?
Indirect point? He was just offering you help. What the hell do you want else.
__________________
I'm pretty much the creator of the PUB: macro used in many scripts today, therefore I'm a legitimate genius.

Ground breaking stuff
Quote:
Originally Posted by ******
I've met Mean on a few occasions in real life, a true genius and a 400 pound all-muscle gorilla alpha male. He has had a great influence on my life.
Quote:
Originally Posted by Kalcor
I don't know where I'd be today without Mean. He has helped me through some tough times in my life. He always brings a smile to my face. Such a positive lad!
Mean is offline  
Old 19/02/2011, 04:50 PM   #8
Serbish
Gangsta
 
Join Date: Apr 2008
Posts: 606
Reputation: 31
Default Re: Set a variable to what they ask

EDIT: I didn't understand it.
Serbish is offline  
Old 19/02/2011, 05:08 PM   #9
Zack9764
Huge Clucker
 
Zack9764's Avatar
 
Join Date: Jun 2008
Posts: 279
Reputation: 1
Default Re: Set a variable to what they ask

Quote:
Originally Posted by Mean View Post
Indirect point? He was just offering you help. What the hell do you want else.
It's a joke..saying he's amazing..

But one question. The variable doesn't get set? :S
__________________
Zack9764 is offline  
Old 19/02/2011, 05:20 PM   #10
maramizo
Gangsta
 
maramizo's Avatar
 
Join Date: Feb 2011
Posts: 686
Reputation: 41
Default Re: Set a variable to what they ask

Quote:
Originally Posted by Zack9764 View Post
It's a joke..saying he's amazing..

But one question. The variable doesn't get set? :S
You mean that when he exits and enters the vehicle, the radio's different?
maramizo is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TextDraws as server variable?? How to i change to Player Variable? DarrenReeder Help Archive 2 06/04/2010 08:02 AM
(19879) : warning 219: local variable "mod" shadows a variable at a preceding le ReactionGameServers Help Archive 4 02/03/2010 09:23 PM
local variable "KillsName" shadows a variable at a preceding level (weird) ғαιιοцт Help Archive 40 14/10/2009 08:04 PM
warning 219: local variable "timecounter" shadows a variable at a preceding leve PKRanger Help Archive 3 08/08/2009 05:04 PM
local variable "tmp2" shadows a variable at a preceding level Battlaman Help Archive 2 04/08/2009 07:10 PM


All times are GMT. The time now is 07:18 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.