SA-MP Forums Archive
Whats wrong with this? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats wrong with this? (/showthread.php?tid=148845)



Whats wrong with this? - DevilRP - 19.05.2010

Whats wrong with this-

Код:
  format(string, sizeof(string),".:BLA BLA BLA %d!:.",VehicleInfo[car][CarOwner]);
	    SendClientMessage(playerid,0xFFFFFFFF,VehicleInfo[car][CarOwner]);
errors-
Код:
 error 029: invalid expression, assumed zero
error 017: undefined symbol "string"
error 017: undefined symbol "string"



Re: Whats wrong with this? - ViruZZzZ_ChiLLL - 19.05.2010

put new string[56];


Re: Whats wrong with this? - DevilRP - 19.05.2010

Thanks, but do you know why when i go in the car it doesnt send the message?


Re: Whats wrong with this? - ViruZZzZ_ChiLLL - 19.05.2010

Quote:
Originally Posted by DevilRP
Thanks, but do you know why when i go in the car it doesnt send the message?
IDK, post the whole message here


Re: Whats wrong with this? - DevilRP - 19.05.2010

here-
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{new stringg[56];
	if(GetPlayerVehicleID(playerid) >= VCount) return 1;
	new car = GetPlayerVehicleID(playerid); 

	if(newstate==PLAYER_STATE_DRIVER)
	{
		new PlayerName[100]; GetPlayerName(playerid,PlayerName,30);
		if(VehicleInfo[car][CarOwned] == 1)
		{
      if(strcmp(PlayerName,VehicleInfo[car][CarOwner],true) == 0) {
   format(stringg, sizeof(stringg),".:!blabla:.");
	    SendClientMessage(playerid,0xFFFFFFFF,"");
      } else {
     format(stringg, sizeof(stringg),".:!%s blabla:.");
	    SendClientMessage(playerid,0xFFFFFFFF,VehicleInfo[car][CarOwner]);    }
		}
		else if(VehicleInfo[car][Buyable] == 0)
		{
    format(stringg, sizeof(stringg),".:blabla:.",VehicleInfo[car][CarOwner]);
	    SendClientMessage(playerid,0xFFFFFFFF,VehicleInfo[car][CarOwner]);
		}
		else
		{
    format(stringg, sizeof(stringg),".:!%d blabla:.",VehicleInfo[car][CarOwner]);
	    SendClientMessage(playerid,0xFFFFFFFF,VehicleInfo[car][CarOwner]);
		}
 	}

	if(newstate==PLAYER_STATE_PASSENGER)
	{
		if(VehicleInfo[car][CarOwned] == 1)
		{
    format(stringg, sizeof(stringg),".:!%s blabla:.",VehicleInfo[car][CarOwner]);
	    SendClientMessage(playerid,0xFFFFFFFF,VehicleInfo[car][CarOwner]);
		}
	}

	return 1;
}



Re: Whats wrong with this? - RoamPT - 19.05.2010

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new stringg[56];
    if(GetPlayerVehicleID(playerid) >= VCount) return 1;
    new car = GetPlayerVehicleID(playerid);
    if(newstate==PLAYER_STATE_DRIVER)
    {
        new PlayerName[100]; GetPlayerName(playerid,PlayerName,30);
        if(VehicleInfo[car][CarOwned] == 1)
        {
            if(strcmp(PlayerName,VehicleInfo[car][CarOwner],true) == 0)
            {
                format(stringg, sizeof(stringg),".:!blabla:.");
                SendClientMessage(playerid,0xFFFFFFFF,stringg);
            }
            else
            {
                format(stringg, sizeof(stringg),".:!%s blabla:.");
                SendClientMessage(playerid,0xFFFFFFFF,stringg);
            }
        }
        else if(VehicleInfo[car][Buyable] == 0)
        {
            format(stringg, sizeof(stringg),".:blabla:.",VehicleInfo[car][CarOwner]);
            SendClientMessage(playerid,0xFFFFFFFF,stringg);
        }
        else
        {
            format(stringg, sizeof(stringg),".:!%d blabla:.",VehicleInfo[car][CarOwner]);
            SendClientMessage(playerid,0xFFFFFFFF,stringg);
        }
    }
    if(newstate==PLAYER_STATE_PASSENGER)
    {
        if(VehicleInfo[car][CarOwned] == 1)
        {
            format(stringg, sizeof(stringg),".:!%s blabla:.",VehicleInfo[car][CarOwner]);
            SendClientMessage(playerid,0xFFFFFFFF,stringg);
        }
    }
    return 1;
}



Re: Whats wrong with this? - DevilRP - 19.05.2010

Thanks, it sends the message now but for example
when i want it to say the name of the player who owns the vehicle it doesnt say it + it doesnt say the price of the vehicle it says "110 blablabla"


Re: Whats wrong with this? - RoamPT - 19.05.2010

else if(VehicleInfo[car][Buyable] == 0)
{
format(stringg, sizeof(stringg),".:Price: %d blabla:.",VehicleInfo[car][CarPrice?]);
SendClientMessage(playerid,0xFFFFFFFF,stringg);
}


Re: Whats wrong with this? - DevilRP - 19.05.2010

Ok, i tryed to do it but when i go in the vehicle it doesnt say the price of the vehicle or its owner..
so here it is as gametext, can you make it into a clientmessage?
the price and owner works as gametext but when i tryed to make it clientmessage it didnt show it like that
here it is as gametext-
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(GetPlayerVehicleID(playerid) >= VCount) return 1;
	new car = GetPlayerVehicleID(playerid);   new msg[256];

	if(newstate==PLAYER_STATE_DRIVER)
	{
		new PlayerName[100]; GetPlayerName(playerid,PlayerName,30);
		if(VehicleInfo[car][CarOwned] == 1)
		{
      if(strcmp(PlayerName,VehicleInfo[car][CarOwner],true) == 0) {
      GameTextForPlayer(playerid,"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~This is your vehicle",2000,3);
      } else {
			format(msg,sizeof(msg),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~This vehicle belongs to %s", VehicleInfo[car][CarOwner] );
		  GameTextForPlayer(playerid,msg,2000,3); }
		}
		else if(VehicleInfo[car][Buyable] == 0)
		{
		format(msg,sizeof(msg),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~This vehicle is not for sell", VehicleInfo[car][CarOwner] );
		GameTextForPlayer(playerid,msg,2000,3);
		}
		else
		{
		format(msg,sizeof(msg),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~This car is for sell Price $%d",VehicleInfo[car][Price]);
    GameTextForPlayer(playerid,msg,2000,3);
		}
 	}

	if(newstate==PLAYER_STATE_PASSENGER)
	{
		if(VehicleInfo[car][CarOwned] == 1)
		{
		format(msg,sizeof(msg),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~w~This vehicle belongs to %s", VehicleInfo[car][CarOwner] );
	  GameTextForPlayer(playerid,msg,2000,3);
		}
	}

	return 1;
}



Re: Whats wrong with this? - RoamPT - 19.05.2010

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(GetPlayerVehicleID(playerid) >= VCount) return 1;
    new car = GetPlayerVehicleID(playerid), msg[256];

    if(newstate==PLAYER_STATE_DRIVER)
    {
        new PlayerName[100]; GetPlayerName(playerid,PlayerName,30);
        if(VehicleInfo[car][CarOwned] == 1)
        {
            if(strcmp(PlayerName,VehicleInfo[car][CarOwner],true) == 0)
            {
                SendClientMessage(playerid,0xFFFFFFFF,"This is your vehicle");
            }
            else
            {
                format(msg,sizeof(msg),"This vehicle belongs to %s", VehicleInfo[car][CarOwner] );
                SendClientMessage(playerid,0xFFFFFFFF,msg);
            }
            else if(VehicleInfo[car][Buyable] == 0)
            {
                format(msg,sizeof(msg),"This vehicle is not for sell", VehicleInfo[car][CarOwner] );
                SendClientMessage(playerid,0xFFFFFFFF,msg);
            }
            else
            {
                format(msg,sizeof(msg),"This car is for sell Price $%d",VehicleInfo[car][Price]);
                SendClientMessage(playerid,0xFFFFFFFF,msg);
            }
        }
        if(newstate==PLAYER_STATE_PASSENGER)
        {
            if(VehicleInfo[car][CarOwned] == 1)
            {
                format(msg,sizeof(msg),"This vehicle belongs to %s", VehicleInfo[car][CarOwner] );
                SendClientMessage(playerid,0xFFFFFFFF,msg);
            }
        }
        return 1;
    }
}