strtok probem
#1

I don't understand, hm..

Код:
	new cmd[255], idx;
	cmd = strtok(cmdtext, idx);
	if(strcmp(cmdtext, "/car", true, 10) == 0)
	{

		new String[200];
		new tmp[256];
		new Float:x, Float:y, Float:z;
        tmp = strtok(cmdtext, idx);
  	    if( ArTuriMasina[ playerid ] == true ) DestroyVehicle( PlayersVehicle[playerid] ), ArTuriMasina[ playerid ] = false;
		if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "INFO: /car [Maљinos Pavadinimas]");

		new vehicle = ModelID(tmp);
		if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, COLOR_RED, "INFO: Tokios maљinos nėra");


		new Float:a;
		GetPlayerFacingAngle(playerid, a);
		GetPlayerPos(playerid, x, y, z);

		if(IsPlayerInAnyVehicle(playerid) == 1)
		{
			XY(playerid, x, y, 10);
		}
		else
		{
			XY(playerid, x, y, 5);
		}


	    PlayersVehicle[playerid] = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
		PutPlayerInVehicle( playerid,  PlayersVehicle[playerid], 0 );

        ArTuriMasina[ playerid ] = true;

		format(String, sizeof(String), "INFO: Tu susikūriai maљiną %s", VNames[vehicle - 400]);
		SendClientMessage(playerid, COLOR_GREEN, String);
		return 1;
	}
Код:
C:\Documents and Settings\Administrator\Desktop\DriftWorld\DriftWorld\gamemodes\Dw.pwn(648) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

Which line is it?
Reply
#3

line 648 is?
Reply
#4

Some strtoks are screwed, and you need to use 255 size, you cannot use 10. So
pawn Код:
new cmd[ 255 ], idx;
Reply
#5

cmd = strtok(cmdtext, idx);
Reply
#6

I use 300 Array size
Reply
#7

Damn, use zcmd & sscanf
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)