error 035: argument type mismatch (argument 3) -
Auri - 08.05.2018
I have a error
The problem log:
Код:
modules/dialogs.inc(1669) : error 035: argument type mismatch (argument 3)
Код:
case D_ACTOR_CREATE_TYPE:
{
if(response)
{
new name[32], desc[128], anim;
GetPVarString(playerid, "ActorCreateName", name, sizeof(name));
GetPVarString(playerid, "ActorCreateTag", desc, sizeof(desc));
new skin = GetPVarInt(playerid, "ActorCreateSkin");
new uid = CreateActors(playerid, name, desc, skin, type, anim);
new string[128];
format(string,sizeof(string),"[ADMIN] You Creata Actor UID %d: %s", uid, ActorCache[uid][aCName]);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string,sizeof(string),"created actor %d: %s", uid,ActorCache[uid][aCName]);
AdminLog(playerid,string);
}
return 1;
}
Line
Код:
new uid = CreateActors(playerid, name, desc, skin, type, anim);
Public CreateActors
Код:
forward CreateActors(playerid, name[32], desc, skin, type, anim);
public CreateActors(playerid, name[32], desc, skin, type, anim)
{
new uid;
new Float:PosX, Float:PosY, Float:PosZ, Float:Angle;
GetPlayerPos(playerid, PosX, PosY, PosZ);
GetPlayerFacingAngle(playerid, Angle);
ForeachEx(i, MAX_ACTORS)
{
if(ActorCache[i][aCUID] == 0 && i != 0)
{
uid = i;
break;
}
}
mysql_real_escape_string(name,name);
mysql_query_format( "INSERT INTO `srv_actors` (`actor_uid`, `actor_name`, `actor_desc`, `actor_skin`, `actor_type`, `actor_posx`, `actor_posy`, `actor_posz`, `actor_posa`, `actor_vw`, `actor_int`, `actor_anim`) VALUES ('%d', '%s', '%s', '%d', '%d', '%f', '%f', '%f', '%f', '%d', '%d', '%d')", uid, name, desc, skin, type, anim, ActorCache[uid][aCPosX], ActorCache[uid][aCPosY], ActorCache[uid][aCPosZ], ActorCache[uid][aCPosA], ActorCache[uid][aCVW], ActorCache[uid][aCInt], ActorCache[uid][aCAnim]);
ActorCache[uid][aCUID] = uid;
ActorCache[uid][aCName] = name;
ActorCache[uid][aCDesc] = desc;
ActorCache[uid][aCSkin] = skin;
ActorCache[uid][aCType] = type;
ActorCache[uid][aCPosX] = PosX;
ActorCache[uid][aCPosY] = PosY;
ActorCache[uid][aCPosZ] = PosZ;
ActorCache[uid][aCPosA] = Angle;
ActorCache[uid][aCVW] = GetPlayerVirtualWorld(playerid);
ActorCache[uid][aCInt] = GetPlayerInterior(playerid);
ActorCache[uid][aCAnim] = anim;
ActorCache[uid][aCNickColor] = COLOR_DO;
return uid;
}
Re: error 035: argument type mismatch (argument 3) -
AlamoTR - 08.05.2018
Код:
forward CreateActors(playerid, name[], desc[], skin, type, anim);
public CreateActors(playerid, name[], desc[], skin, type, anim)
{
Re: error 035: argument type mismatch (argument 3) -
Auri - 08.05.2018
error
Код:
modules/actors.inc(22) : error 047: array sizes do not match, or destination array is too small
modules/actors.inc(23) : error 047: array sizes do not match, or destination array is too small
Код:
forward CreateActors(playerid, name[], desc[], skin, type, anim);
public CreateActors(playerid, name[], desc[], skin, type, anim)
{
new uid;
new Float:PosX, Float:PosY, Float:PosZ, Float:Angle;
GetPlayerPos(playerid, PosX, PosY, PosZ);
GetPlayerFacingAngle(playerid, Angle);
ForeachEx(i, MAX_ACTORS)
{
if(ActorCache[i][aCUID] == 0 && i != 0)
{
uid = i;
break;
}
}
mysql_real_escape_string(name,name);
mysql_query_format( "INSERT INTO `srv_actors` (`actor_uid`, `actor_name`, `actor_desc`, `actor_skin`, `actor_type`, `actor_posx`, `actor_posy`, `actor_posz`, `actor_posa`, `actor_vw`, `actor_int`, `actor_anim`) VALUES ('%d', '%s', '%s', '%d', '%d', '%f', '%f', '%f', '%f', '%d', '%d', '%d')", uid, name, desc, skin, type, anim, ActorCache[uid][aCPosX], ActorCache[uid][aCPosY], ActorCache[uid][aCPosZ], ActorCache[uid][aCPosA], ActorCache[uid][aCVW], ActorCache[uid][aCInt], ActorCache[uid][aCAnim]);
ActorCache[uid][aCUID] = uid;
ActorCache[uid][aCName] = name;
ActorCache[uid][aCDesc] = desc;
ActorCache[uid][aCSkin] = skin;
ActorCache[uid][aCType] = type;
ActorCache[uid][aCPosX] = PosX;
ActorCache[uid][aCPosY] = PosY;
ActorCache[uid][aCPosZ] = PosZ;
ActorCache[uid][aCPosA] = Angle;
ActorCache[uid][aCVW] = GetPlayerVirtualWorld(playerid);
ActorCache[uid][aCInt] = GetPlayerInterior(playerid);
ActorCache[uid][aCAnim] = anim;
ActorCache[uid][aCNickColor] = COLOR_DO;
return uid;
}
Line 22
Код:
ActorCache[uid][aCName] = name;
Line 23
Код:
ActorCache[uid][aCDesc] = desc
I don't understand this code. I'm new programer its my first script.
Re: error 035: argument type mismatch (argument 3) -
ISmokezU - 09.05.2018
You declared both name and desc as an array you have to index them. Loop through the actors to find the specific id.
Re: error 035: argument type mismatch (argument 3) -
CyNiC - 09.05.2018
format
https://sampwiki.blast.hk/wiki/Format
pawn Код:
format(ActorCache[uid][aCName], MAX_PLAYER_NAME, name);
Re: error 035: argument type mismatch (argument 3) -
DarkSkull - 09.05.2018
Line 22
Код:
ActorCache[uid][aCName] = name;
Line 23
Код:
ActorCache[uid][aCDesc] = desc
You can't assign strings like that in PAWN. You should use format, or you can use a nice little snippet.
Код:
#if !defined strcpy
#define strcpy(%0,%1,%2) strcat((%0[0] = '\0', %0), %1, %2)
#endif
It stands for string copy. You use it like.
Код:
strcpy(destination, source, size);
So now, change those lines to.
Код:
strcpy(name,ActorCache[uid][aCName],MAX_PLAYER_NAME);
strcpy(name,ActorCache[uid][aCDesc],256);
Change that 256 to the size of the variable.