Error 035: argument type mismatch (argument 1) -
seanny - 24.12.2013
Код:
G:\Scripting\gamemodes\hrp.pwn(3374) : error 035: argument type mismatch (argument 1)
G:\Scripting\gamemodes\hrp.pwn(3378) : error 035: argument type mismatch (argument 1)
G:\Scripting\gamemodes\hrp.pwn(3382) : error 035: argument type mismatch (argument 1)
G:\Scripting\gamemodes\hrp.pwn(3386) : error 035: argument type mismatch (argument 1)
pawn Код:
forward CreateOwnableCar(playerid,vehicle);
public CreateOwnableCar(playerid,vehicle)
{
if(DebugEnabled == 1) { SendClientMessage(playerid,COLOR_WHITE,"DEBUG: CreateOwnableCar();"); }
new string[256], plate[9];
for(new i = 0; i < sizeof(VehicleInfo); i++)
{
if(VehicleInfo[i][vOwned] == 0 && IsValidVehicle(i) == 0)
{
if(PlayerInfo[playerid][pCarkey] == 999)
{
if(GetMoney(playerid) >= GetVehiclePrice(vehicle))
{
format(string, sizeof(string), "You have bought a %s for $%d.",GetVehicleName(vehicle), GetVehiclePrice(vehicle));
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
SendClientMessage(playerid,COLOR_WHITE,"Check out /vehiclehelp to see your new commands.");
TakeMoney(playerid,GetVehiclePrice(vehicle));
BusinessInfo[BuyingVehicle[playerid]][bTill] += GetVehiclePrice(vehicle);
VehicleInfo[i][vOwned] = 1;
VehicleInfo[i][vModel] = vehicle;
VehicleInfo[i][vPrice] = GetVehiclePrice(vehicle);
VehicleInfo[i][vColour1] = 1;
VehicleInfo[i][vColour2] = 1;
VehicleInfo[i][vLocked] = 0;
VehicleInfo[i][vSpawnX] = BusinessInfo[BuyingVehicle[playerid]][bVehicleX];
VehicleInfo[i][vSpawnY] = BusinessInfo[BuyingVehicle[playerid]][bVehicleY];
VehicleInfo[i][vSpawnZ] = BusinessInfo[BuyingVehicle[playerid]][bVehicleZ];
VehicleInfo[i][vSpawnR] = BusinessInfo[BuyingVehicle[playerid]][bVehicleR];
VehicleInfo[i][vFuel] = 100;
VehicleInfo[i][vRadio] = 0;
VehicleInfo[i][vHealth] = 1000;
VehicleInfo[i][vInterior] = 0;
VehicleInfo[i][vSpawned] = 0;
strmid(VehicleInfo[i][vOwner], GetNameEx(playerid), 0, strlen(GetNameEx(playerid)), 255);
new carid = AddStaticVehicleEx(VehicleInfo[i][vModel],VehicleInfo[i][vSpawnX],VehicleInfo[i][vSpawnY],VehicleInfo[i][vSpawnZ]+1,VehicleInfo[i][vSpawnR],VehicleInfo[i][vColour1],VehicleInfo[i][vColour2],3600);
if(i < 10)
{
format(plate, sizeof(plate), "%s%d%d", GetFirstLetters(playerid), i, random(9999));//Line 3374
}
else if(i < 100 && i >= 10)
{
format(plate, sizeof(plate), "%s%d%d", GetFirstLetters(playerid), i, random(999));//Line 3378
}
else if(i >= 100 && i < 1000)
{
format(plate, sizeof(plate), "%s%d%d", GetFirstLetters(playerid), i, random(99));//Line 3382
}
else
{
format(plate, sizeof(plate), "%s%d%d", GetFirstLetters(playerid), i, random(9));//Line 3386
}
SetVehicleNumberPlate(carid, "%s");
SetVehicleToRespawn(carid);
VehicleOwned[carid] = carid;
PlayerInfo[playerid][pCarkey] = i;
SaveAccountInfo(playerid);
SaveVehicle(PlayerInfo[playerid][pCarkey]);
}
else
{
format(string, sizeof(string), "* You do not have enough money to purchase this vehicle, you need $%d.", GetVehiclePrice(vehicle));
SendClientMessage(playerid,COLOR_LIGHTRED,string);
}
return 1;
}
else SendClientMessage(playerid,COLOR_LIGHTRED,"* You already own a vehicle.");
return 1;
}
}
if(DebugEnabled == 1) { printf("DEBUG: CreateOwnableCar(%d, %d) ended.", playerid, vehicle); }
return 1;
}
Fixed, please lock and archive. I used the Paramaters for GetFirstLetters incorrectly, I was supposed to use the players name instead of their id.
Lock and Archive.
Re: Error 035: argument type mismatch (argument 1) -
R4mpage - 24.12.2013
Could you show me what the lines are maybe?
The Lines that are the error givers
Edit
The problem is that you do not have spaces at the %s%d%d
The script would be:
PHP код:
forward CreateOwnableCar(playerid,vehicle);
public CreateOwnableCar(playerid,vehicle)
{
if(DebugEnabled == 1) { SendClientMessage(playerid,COLOR_WHITE,"DEBUG: CreateOwnableCar();"); }
new string[256], plate[9];
for(new i = 0; i < sizeof(VehicleInfo); i++)
{
if(VehicleInfo[i][vOwned] == 0 && IsValidVehicle(i) == 0)
{
if(PlayerInfo[playerid][pCarkey] == 999)
{
if(GetMoney(playerid) >= GetVehiclePrice(vehicle))
{
format(string, sizeof(string), "You have bought a %s for $%d.",GetVehicleName(vehicle), GetVehiclePrice(vehicle));
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
SendClientMessage(playerid,COLOR_WHITE,"Check out /vehiclehelp to see your new commands.");
TakeMoney(playerid,GetVehiclePrice(vehicle));
BusinessInfo[BuyingVehicle[playerid]][bTill] += GetVehiclePrice(vehicle);
VehicleInfo[i][vOwned] = 1;
VehicleInfo[i][vModel] = vehicle;
VehicleInfo[i][vPrice] = GetVehiclePrice(vehicle);
VehicleInfo[i][vColour1] = 1;
VehicleInfo[i][vColour2] = 1;
VehicleInfo[i][vLocked] = 0;
VehicleInfo[i][vSpawnX] = BusinessInfo[BuyingVehicle[playerid]][bVehicleX];
VehicleInfo[i][vSpawnY] = BusinessInfo[BuyingVehicle[playerid]][bVehicleY];
VehicleInfo[i][vSpawnZ] = BusinessInfo[BuyingVehicle[playerid]][bVehicleZ];
VehicleInfo[i][vSpawnR] = BusinessInfo[BuyingVehicle[playerid]][bVehicleR];
VehicleInfo[i][vFuel] = 100;
VehicleInfo[i][vRadio] = 0;
VehicleInfo[i][vHealth] = 1000;
VehicleInfo[i][vInterior] = 0;
VehicleInfo[i][vSpawned] = 0;
strmid(VehicleInfo[i][vOwner], GetNameEx(playerid), 0, strlen(GetNameEx(playerid)), 255);
new carid = AddStaticVehicleEx(VehicleInfo[i][vModel],VehicleInfo[i][vSpawnX],VehicleInfo[i][vSpawnY],VehicleInfo[i][vSpawnZ]+1,VehicleInfo[i][vSpawnR],VehicleInfo[i][vColour1],VehicleInfo[i][vColour2],3600);
if(i < 10)
{
format(plate, sizeof(plate), "%s %d %d", GetFirstLetters(playerid), i, random(9999));//Line 3374
}
else if(i < 100 && i >= 10)
{
format(plate, sizeof(plate), "%s %d %d", GetFirstLetters(playerid), i, random(999));//Line 3378
}
else if(i >= 100 && i < 1000)
{
format(plate, sizeof(plate), "%s %d %d", GetFirstLetters(playerid), i, random(99));//Line 3382
}
else
{
format(plate, sizeof(plate), "%s %d %d", GetFirstLetters(playerid), i, random(9));//Line 3386
}
SetVehicleNumberPlate(carid, "%s");
SetVehicleToRespawn(carid);
VehicleOwned[carid] = carid;
PlayerInfo[playerid][pCarkey] = i;
SaveAccountInfo(playerid);
SaveVehicle(PlayerInfo[playerid][pCarkey]);
}
else
{
format(string, sizeof(string), "* You do not have enough money to purchase this vehicle, you need $%d.", GetVehiclePrice(vehicle));
SendClientMessage(playerid,COLOR_LIGHTRED,string);
}
return 1;
}
else SendClientMessage(playerid,COLOR_LIGHTRED,"* You already own a vehicle.");
return 1;
}
}
if(DebugEnabled == 1) { printf("DEBUG: CreateOwnableCar(%d, %d) ended.", playerid, vehicle); }
return 1;
}
Re: Error 035: argument type mismatch (argument 1) -
R4mpage - 24.12.2013
Look my edited message above
Re: Error 035: argument type mismatch (argument 1) -
seanny - 24.12.2013
But why would I need spaces? That would then use up all the space I need for the vehicle plates, I've seen similar scripts where there was no spaces in the number plates, that couldn't be it.
Re: Error 035: argument type mismatch (argument 1) -
R4mpage - 24.12.2013
To be honest, I learned scripting with spaces at those parts, I would always get an error if i didnt, so please try that, and say if it has worked.
You Could also try and make it like this:
%s-%d-%d instead of the spaces
Re: Error 035: argument type mismatch (argument 1) -
seanny - 24.12.2013
It makes no difference at all to my script compiler, so it obviously ain't that.
Re: Error 035: argument type mismatch (argument 1) -
seanny - 25.12.2013
Fixed, please lock and archive. I used the Paramaters for GetFirstLetters incorrectly, I was supposed to use the players name instead of their id.
Lock and Archive.