Onplayerkeystatechange command possible?
#3

Well first of all it's [ pawn ][ /pawn ] to put something in the PAWN code (without the spaces).
Also your code is much easier to read when you indent it, e.g.
pawn Код:
public OnPlayerDoSomething(playerid,somethingid){
    if(something is true){
        DoSomething(param1,param2);
    }
    else {
        DoSomethingElse(blah);
    }
    return 1;
}
I have tidied up your code, and here is a tutorial on how to use OnPlayerKeyStateChange.
pawn Код:
new str1[255], str2[255], pname[24], busnumber;

busnumber = GetBusID(playerid);
format(str1, sizeof(str1), "business/busid%d", busnumber);
GetPlayerName(playerid, pname, 24);
playerworld[playerid] = GetPlayerVirtualWorld(playerid);
SendClientMessage(playerid, c_y, "You entered the business!");

if(strcmp(bInfo[busnumber][bName],pname,true)==0)SendClientMessage(playerid, c_y, "Welcome to your business!");
else if (strcmp(bInfo[busnumber][bName],"ForSale",true))
{
    GivePlayerMoney(playerid, -bInfo[busnumber][bEnterfee]);
    bInfo[busnumber][bBusinessbank] = bInfo[busnumber][bBusinessbank] + bInfo[busnumber][bEnterfee];
    format(str2,sizeof(str2),"You have paid: $%d to the owner of this business",bInfo[busnumber][bEnterfee]);
    SendClientMessage(playerid, c_y, str2);
}
else
{
    GivePlayerMoney(playerid, -bInfo[busnumber][bEnterfee]);
    format(str2,sizeof(str2),"You have paid: $%d to enter this business",bInfo[busnumber][bEnterfee]);
    SendClientMessage(playerid, c_y, str2);
}
SetPlayerVirtualWorld(playerid, bInfo[busnumber][bVirtualworld]);
SetPlayerInterior(playerid, bInfo[busnumber][bInterior]);
SetPlayerPos(playerid, bInfo[busnumber][bInteriorX], bInfo[busnumber][bInteriorY], bInfo[busnumber][bInteriorZ]);
playerinterior[playerid] = bInfo[busnumber][bInterior];
GetPlayerPos(playerid, busx, busy, busz);
Isplayerinbus[playerid] = 1;
   
//And this is exit:
   
if(GetPlayerInterior(playerid)==playerinterior[playerid])
{
    SetPlayerPos(playerid, busx, busy, busz);
    SetPlayerInterior(playerid, playerworld[playerid]);
    Isplayerinbus[playerid] = 0;
    Bustypeenter[playerid] = 0;
}
else SendClientMessage(playerid, c_r, "You have not entered a house!");
And here is a table I made of the key values and the keys used to create them in and out of vehicles:

*This value is the only one on this table, which can be simulated by pressing two different keys at the same time. It was included because one key gives off this value.
Reply


Messages In This Thread
Onplayerkeystatechange command possible? - by jorambo - 23.10.2010, 16:27
Re: Onplayerkeystatechange command possible? - by willsuckformoney - 23.10.2010, 16:30
Re: Onplayerkeystatechange command possible? - by Badger(new) - 23.10.2010, 16:40

Forum Jump:


Users browsing this thread: 1 Guest(s)