#1

Код HTML:
F:\CNR - RP\gamemodes\arcnr2p.pwn(10009) : error 033: array must be indexed (variable "pname")
F:\CNR - RP\gamemodes\arcnr2p.pwn(10040) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Код HTML:
	if(newstate == PLAYER_STATE_DRIVER)
	{
		new pveh =GetPlayerVehicleID(playerid);
		if(VehicleInfo[pveh][bought] == pname && VehicleInfo[pveh][bought] <= MAX_PLAYERS_) [COLOR="Red"]this line 1009[/COLOR]
		{
		    if(playerid == VehicleInfo[pveh][bought])
		    {
		        SendClientMessage(playerid,COLOR_LIME,"Welcome to your bought vehicle from Otto's Cars.");
		        return 1;
			}
			if(playerid != VehicleInfo[pveh][bought] && gTeam[playerid] != TEAM_CARJACK)
			{
			    format(string,sizeof(string),"This vehicle is owned by %s(%d). You cannot drive it as you don't own it.",PlayerName(VehicleInfo[pveh][bought]),VehicleInfo[pveh][bought]);
			    SendClientMessage(playerid,COLOR_ERROR,string);
			    RemovePlayerFromVehicle(playerid);
			    return 1;
			}
			if(playerid != VehicleInfo[pveh][bought] && gTeam[playerid] == TEAM_CARJACK)
			{
			    SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Vehicle Stolen_]]");
			    format(string,sizeof(string),"You have stolen %s(%d)'s purchased vehicle from Otto's Cars!",PlayerName(VehicleInfo[pveh][bought]),VehicleInfo[pveh][bought]);
			    SendClientMessage(playerid,COLOR_ERROR,string);
			    IncreaseWantedLevel(playerid,6);
			    IncreasePlayerScore(playerid,2);

				format(string,sizeof(string),"Car Jacker %s(%d) has stolen your purchased vehicle from Otto's Cars!",PlayerName(playerid),playerid);
				SendClientMessage(VehicleInfo[pveh][bought],COLOR_RED,string);
				
				format(string,sizeof(string),"[VEHICLE THEFT] Car Jacker %s(%d) has stolen %s(%d)'s purchased vehicle from Otto's Cars!",PlayerName(playerid),playerid,PlayerName(VehicleInfo[pveh][bought]),VehicleInfo[pveh][bought]);
				SendClientMessageToAll(COLOR_RED,string);
				
				format(string,sizeof(string),"[POLICE RADIO] Theft: Car Jacker %s(%d) has stolen %s(%d)'s purchased vehicle from Otto's Cars!",PlayerName(playerid),playerid,PlayerName(VehicleInfo[pveh][bought]),VehicleInfo[pveh][bought]);
			    SendClientMessageToAllCops(string);
			    
			    VehicleInfo[pveh][bought] = pname; [COLOR="red"]this line 10040[/COLOR]
			    VehicleInfo[pveh][stolen] =1;
Reply
#2

In which line is the errors ?
Reply
#3

if(VehicleInfo[pveh][bought] == pname && VehicleInfo[pveh][bought] <= MAX_PLAYERS_) this line 1009

VehicleInfo[pveh][bought] = pname; this line 10040
Reply
#4

pawn Код:
new pname[25];
Reply
#5

its does'nt help
Reply
#6

Quote:
Originally Posted by ridhoswasta
Посмотреть сообщение
its does'nt help
Did you read my reply in your previous thread ?
Reply
#7

Quote:
Originally Posted by Clad
Посмотреть сообщение
Did you read my reply in your previous thread ?
i have do that , its work , but its buggy, every car i use say "Welcome to your bought vehicle from Otto's Cars"

my english is bad, sorry
Reply
#8

You can't easily compare strings with == or check the strings length by => <= > even <
You need strcmp, and strlen.
pawn Код:
if(VehicleInfo[pveh][bought] == pname && VehicleInfo[pveh][bought] <= MAX_PLAYERS_)
Should be:
pawn Код:
if(!strcmp(VehicleInfo[pveh][bought], pname) && strlen(VehicleInfo[pveh][bought]) <= MAX_PLAYERS_NAME)
Reply
#9

Quote:
Originally Posted by RenovanZ
Посмотреть сообщение
You can't easily compare strings with == or check the strings length by => <= > even <
You need strcmp, and strlen.
pawn Код:
if(VehicleInfo[pveh][bought] == pname && VehicleInfo[pveh][bought] <= MAX_PLAYERS_)
Should be:
pawn Код:
if(!strcmp(VehicleInfo[pveh][bought], pname) && strlen(VehicleInfo[pveh][bought]) <= MAX_PLAYERS_NAME)
its work , but still buggy
Reply
#10

Quote:
Originally Posted by Clad
Посмотреть сообщение
Did you read my reply in your previous thread ?
I don't think it makes a bug lol, Good luck anyway I know only that way
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)