#1

Hi all i have a probelm,

i go this error "error 047: array sizes do not match, or destination array is too small"

it say thats wrong "cmd = strtok(params, idx);"

how i can resove it ?
Reply
#2

show code
Reply
#3

047: array sizes do not match, or destination array is too small
For array assignment, the arrays on the left and the right side of the assignment operator must have the same number of dimensions. In addition:
for multi-dimensional arrays, both arrays must have the same size;
for single arrays with a single dimension, the array on the left side of the assignment operator must have a size that is equal or bigger than the one on the right side.
PHP код:
new destination[8];
new 
msg[] = "Hello World!";
 
destination msg
In the above code, we try to fit 12 characters in an array that can only support 8. By increasing the array size of the destination, we can solve this. Note that a string also requires a null terminator so the total length of "Hello World!" plus the null terminator is, in fact, 13.
PHP код:
new destination[13];
new 
msg[] = "Hello World!";
 
destination msg
Resource : https://sampwiki.blast.hk/wiki/Errors_List
Good Luck.
Reply
#4

Quote:
Originally Posted by lanix
Посмотреть сообщение
show code
dcmd_V(playerid, params[])
{
new cmd[200], idx;
cmd = strtok(params, idx);
new String[200];
new tmp[256];
new Float, Float:y, Float:z;
tmp = strtok(params, idx);
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:You are already in a vehicle.");
if(!strlen(tmp)) return SendClientMessage(playerid, COLORE_ROSSO, "USE:/v [VehicleName/VehicleId].");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, COLORE_ROSSO, "ERROR:That vehicle does not exist.");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
DestroyVehicle(PlayersVehicle);
PlayersVehicle = CreateVehicle(vehicle, x, y, z, a, -1, -1, -1);
format(String, sizeof(String), "INFO:You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, COLORE_VERDE, String);
PutPlayerInVehicle(playerid, PlayersVehicle, 0);
return 1;
}
Reply
#5

Try to increase cmd's array size. (new cmd[400], idx;)
Increase them from 200 to 400 then tell me the result.
Reply
#6

Quote:
Originally Posted by Alpay0098
Посмотреть сообщение
Try to increase cmd's array size. (new cmd[400], idx;)
Increase them from 200 to 400 then tell me the result.
omg work thx thx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)