SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 23/11/2017, 11:06 PM   #1
Cutiexoxo
Little Clucker
 
Join Date: Jan 2017
Posts: 7
Reputation: 0
Default error 035: argument type mismatch (argument 2)

I added a new command to my gamemode and i got this error
Code:
CMD:announce(playerid, params[])
{

    if(!IsPlayerAdmin(playerid))
	return SendClientMessage(playerid, "You are not allowed to use this command");
    new text[64], time, style;
    if (sscanf(params, "iis[64]", style, time, text)) return
    SendClientMessage( playerid,"Usage: /announce <style[0-6]> <time in ms> <text>");
    if (strlen(text) > 64) return
    SendClientMessage(playerid,"Message too long please shorten it ");
    if(style == 2) return SendClientMessage(playerid,"Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
    SendClientMessage(playerid,0xFF0000FF,"Invalid style");
    if (time > 20*1000) return
    SendClientMessage(playerid,"No longer than 20 seconds");
    GameTextForAll(text, time, style);

    return 1;
}
Error :
Code:
 
C:\Users\Loed\Desktop\LOD.pwn(33184) : error 035: argument type mismatch (argument 2)
C:\Users\Loed\Desktop\LOD.pwn(33187) : error 035: argument type mismatch (argument 2)
C:\Users\Loed\Desktop\LOD.pwn(33189) : error 035: argument type mismatch (argument 2)
C:\Users\Loed\Desktop\LOD.pwn(33190) : error 035: argument type mismatch (argument 2)
C:\Users\Loed\Desktop\LOD.pwn(33194) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
Help please
Cutiexoxo is offline   Reply With Quote
Old 23/11/2017, 11:26 PM   #2
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 2,455
Reputation: 515
Default Re: error 035: argument type mismatch (argument 2)

http://wiki.sa-mp.com/wiki/SendClientMessage

You forgot about colour.
Misiur is offline   Reply With Quote
Old 23/11/2017, 11:29 PM   #3
L97
Little Clucker
 
Join Date: Nov 2017
Posts: 10
Reputation: 0
Default Re: error 035: argument type mismatch (argument 2)

Here you go:
Code:
CMD:announce(playerid, params[])
{

    if(!IsPlayerAdmin(playerid))
	return SendClientMessage(playerid, -1, "You are not allowed to use this command");
    new text[64], time, style;
    if (sscanf(params, "iis[64]", style, time, text)) return
    SendClientMessage( playerid, -1, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if (strlen(text) > 64) return
    SendClientMessage(playerid,"Message too long please shorten it ");
    if(style == 2) return SendClientMessage(playerid, -1, "Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
    SendClientMessage(playerid,0xFF0000FF,"Invalid style");
    if (time > 20*1000) return
    SendClientMessage(playerid, -1, "No longer than 20 seconds");
    GameTextForAll(text, time, style);

    return 1;
}
SendClientMessage requires a color as second parameter.
L97 is offline   Reply With Quote
Old 23/11/2017, 11:49 PM   #4
Cutiexoxo
Little Clucker
 
Join Date: Jan 2017
Posts: 7
Reputation: 0
Default Re: error 035: argument type mismatch (argument 2)

Thank You so much @L97 and @Misiur +Rep to both of you <3
Cutiexoxo is offline   Reply With Quote
Old 24/11/2017, 07:42 AM   #5
billy1337samp
Banned
 
Join Date: Jun 2016
Posts: 53
Reputation: 9
Default Re: error 035: argument type mismatch (argument 2)

PHP Code:
return SendClientMessage(playerid"You are not allowed to use this command"); 
PHP Code:
SendClientMessage(playerid,"Message too long please shorten it "); 
You are missing the colour it should be for example
PHP Code:
SendClientMessage(playerid, -1"string"); //replace -1 
where -1 is a colour.

error 035 is always argument type mismatch so go through that code and make sure you haven't missed anything out.
you can see it says argument 2

SendClientMessage(1playerid,"3Message too long please shorten it ");

you are missing argument 2 so it should be:

SendClientMessage(1playerid,2-1,"3Message too long please shorten it ");

Last edited by billy1337samp; 24/11/2017 at 04:33 PM.
billy1337samp is offline   Reply With Quote
Reply

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
C:\Users\Lirbo\Desktop\Roleplay\gamemodes\ERP.pwn( 19) : error 035: argument type mismatch (argument 1) Lirbo Scripting Help 2 12/12/2014 03:51 PM
error 35: Argument Type Mismatch (argument 2) Forbidden Name System Stoyanov Scripting Help 2 01/11/2014 09:50 PM
error 035: argument type mismatch (argument 2) [Using MySQL R7/R8 With Cache] viveka27 Scripting Help 1 21/05/2013 04:31 PM


All times are GMT. The time now is 12:25 AM.


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