new PlayerText:Textdraw0[MAX_PLAYERS];
new PlayerText:Textdraw1[MAX_PLAYERS];
new PlayerText:Textdraw2[MAX_PLAYERS];
Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 35.666641, 137.303726, "New Textdraw");
PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.449999, 1.600000);
PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw0[playerid], -1);
PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 51);
PlayerTextDrawFont(playerid, Textdraw0[playerid], 1);
PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Textdraw0[playerid], true);
Textdraw1[playerid] = CreatePlayerTextDraw(playerid, 35.666645, 150.333389, "New Textdraw");
PlayerTextDrawLetterSize(playerid, Textdraw1[playerid], 0.449999, 1.600000);
PlayerTextDrawAlignment(playerid, Textdraw1[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw1[playerid], -1);
PlayerTextDrawSetShadow(playerid, Textdraw1[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw1[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, Textdraw1[playerid], 51);
PlayerTextDrawFont(playerid, Textdraw1[playerid], 1);
PlayerTextDrawSetProportional(playerid, Textdraw1[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Textdraw1[playerid], true);
Textdraw2[playerid] = CreatePlayerTextDraw(playerid, 35.666645, 162.533340, "New Textdraw");
PlayerTextDrawLetterSize(playerid, Textdraw2[playerid], 0.449999, 1.600000);
PlayerTextDrawAlignment(playerid, Textdraw2[playerid], 1);
PlayerTextDrawColor(playerid, Textdraw2[playerid], -1);
PlayerTextDrawSetShadow(playerid, Textdraw2[playerid], 0);
PlayerTextDrawSetOutline(playerid, Textdraw2[playerid], 1);
PlayerTextDrawBackgroundColor(playerid, Textdraw2[playerid], 51);
PlayerTextDrawFont(playerid, Textdraw2[playerid], 1);
PlayerTextDrawSetProportional(playerid, Textdraw2[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Textdraw2[playerid], true);
new bool:IsViewingMenu[MAX_PLAYERS];//on top
new current[MAX_PLAYERS] = -1;//specifies the current text draw on which player pointer is
IsViewingMenu[playerid] = true;//when u show menu to the player using TextDrawShowForplayer
public OnPlayerUpdate(playerid)
{
if(IsViewingMenu[playerid])
{
new Keys,ud,lr;
GetPlayerKeys(playerid,Keys,ud,lr);//for getting player keys up and down you can read about this in wiki
if(ud == KEY_DOWN && cuurent[playerid] != 4)//to do nothing when the pointer is at last text draw,i.e., 4
{
current[playerid]++;
switch(current[playerid])
{
case 0 : PlayerTextDrawColor(playerid, Textdraw0[playerid], 0xFF0000FF); //setting current text draw color to red
case 1 :
{
PlayerTextDrawColor(playerid, Textdraw0[playerid], -1);//setting old text draw color to back to white
PlayerTextDrawColor(playerid, Textdraw1[playerid], 0xFF0000FF);
}
case 2 :
{
PlayerTextDrawColor(playerid, Textdraw1[playerid], -1);//setting old text draw color to back to white
PlayerTextDrawColor(playerid, Textdraw2[playerid], 0xFF0000FF);
}
//like this for others too
}//end of switch
else if(ud == KEY_UP && (cuurent[playerid] != -1 || current[playerid] != 0))//to do nothing when pointer is nowhere or at first textdraw ,i.e, 0
{
current[playerid]--;
switch(current[playerid])
{
case 0 :
{
PlayerTextDrawColor(playerid, Textdraw0[playerid], 0xFF0000FF);//setting current pointer color to red
PlayerTextDrawColor(playerid, Textdraw1[playerid], -1);//setting textdraw color where pointer "was" back to white
}
case 1 :
{
PlayerTextDrawColor(playerid, Textdraw1[playerid], 0xFF0000FF);//setting current pointer color to red
PlayerTextDrawColor(playerid, Textdraw2[playerid], -1);//setting textdraw color where pointer "was" back to white
}
//like this for others
}//end of switch
}
}
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsViewingMenu[playerid])
{
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE) && current[playerid] != -1)//change to key whatever u want
{
switch(current[playerid])
{
case 0://player is on menu item 1 do something
case 1://player is on menu item 2
}
}
}
return 1;
}
//this all when u hide menu or player disconnects
current[playerid] = -1;
IsViewingMenu[playerid] = false;
Good luck with that.. I suggest using that menu system instead of making things complicated for your self. If you do use the menu code there must a way to use the "mouse control option".
|
// This is a comment // uncomment the line below if you want to write a filterscript #define FILTERSCRIPT #include <a_samp> new PlayerText:Textdraw0[MAX_PLAYERS]; new PlayerText:Textdraw1[MAX_PLAYERS]; new PlayerText:Textdraw2[MAX_PLAYERS]; new bool:IsViewingMenu[MAX_PLAYERS];//on top new current[MAX_PLAYERS] = -1;//specifies the current text draw on which player pointer is Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 35.666641, 137.303726, "New Textdraw"); PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.449999, 1.600000); PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1); PlayerTextDrawColor(playerid, Textdraw0[playerid], -1); PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0); PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 1); PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 51); PlayerTextDrawFont(playerid, Textdraw0[playerid], 1); PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1); PlayerTextDrawSetSelectable(playerid, Textdraw0[playerid], true); Textdraw1[playerid] = CreatePlayerTextDraw(playerid, 35.666645, 150.333389, "New Textdraw"); PlayerTextDrawLetterSize(playerid, Textdraw1[playerid], 0.449999, 1.600000); PlayerTextDrawAlignment(playerid, Textdraw1[playerid], 1); PlayerTextDrawColor(playerid, Textdraw1[playerid], -1); PlayerTextDrawSetShadow(playerid, Textdraw1[playerid], 0); PlayerTextDrawSetOutline(playerid, Textdraw1[playerid], 1); PlayerTextDrawBackgroundColor(playerid, Textdraw1[playerid], 51); PlayerTextDrawFont(playerid, Textdraw1[playerid], 1); PlayerTextDrawSetProportional(playerid, Textdraw1[playerid], 1); PlayerTextDrawSetSelectable(playerid, Textdraw1[playerid], true); Textdraw2[playerid] = CreatePlayerTextDraw(playerid, 35.666645, 162.533340, "New Textdraw"); PlayerTextDrawLetterSize(playerid, Textdraw2[playerid], 0.449999, 1.600000); PlayerTextDrawAlignment(playerid, Textdraw2[playerid], 1); PlayerTextDrawColor(playerid, Textdraw2[playerid], -1); PlayerTextDrawSetShadow(playerid, Textdraw2[playerid], 0); PlayerTextDrawSetOutline(playerid, Textdraw2[playerid], 1); PlayerTextDrawBackgroundColor(playerid, Textdraw2[playerid], 51); PlayerTextDrawFont(playerid, Textdraw2[playerid], 1); PlayerTextDrawSetProportional(playerid, Textdraw2[playerid], 1); PlayerTextDrawSetSelectable(playerid, Textdraw2[playerid], true); #if defined FILTERSCRIPT #else main() { print("\n----------------------------------"); print(" -----------------------------------"); print("----------------------------------\n"); } #endif public OnPlayerUpdate(playerid) { if(IsViewingMenu[playerid]) { new Keys,ud,lr; GetPlayerKeys(playerid,Keys,ud,lr);//for getting player keys up and down you can read about this in wiki if(ud == KEY_DOWN && current[playerid] != 4)//to do nothing when the pointer is at last text draw,i.e., 4 { current[playerid]++; switch(current[playerid]) { case 0 : PlayerTextDrawColor(playerid, Textdraw0[playerid], 0xFF0000FF); //setting current text draw color to red case 1 : { PlayerTextDrawColor(playerid, Textdraw0[playerid], -1);//setting old text draw color to back to white PlayerTextDrawColor(playerid, Textdraw1[playerid], 0xFF0000FF); } case 2 : { PlayerTextDrawColor(playerid, Textdraw1[playerid], -1);//setting old text draw color to back to white PlayerTextDrawColor(playerid, Textdraw2[playerid], 0xFF0000FF); } case 3 : { PlayerTextDrawColor(playerid, Textdraw2[playerid], -1);//setting old text draw color to back to white } }//end of switch else if(ud == KEY_UP && (current[playerid] != -1 || current[playerid] != 0))//to do nothing when pointer is nowhere or at first textdraw ,i.e, 0 { current[playerid]--; switch(current[playerid]) { case 0 : { PlayerTextDrawColor(playerid, Textdraw0[playerid], 0xFF0000FF);//setting current pointer color to red PlayerTextDrawColor(playerid, Textdraw1[playerid], -1);//setting textdraw color where pointer "was" back to white } case 1 : { PlayerTextDrawColor(playerid, Textdraw1[playerid], 0xFF0000FF);//setting current pointer color to red PlayerTextDrawColor(playerid, Textdraw2[playerid], -1);//setting textdraw color where pointer "was" back to white } case 3 : { PlayerTextDrawColor(playerid, Textdraw2[playerid], 0xFF0000FF);//setting current pointer color to red PlayerTextDrawColor(playerid, Textdraw3[playerid], -1);//setting textdraw color where pointer "was" back to white } case 4 : { PlayerTextDrawColor(playerid, Textdraw3[playerid], 0xFF0000FF);//setting current pointer color to red } }//end of switch } } return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(IsViewingMenu[playerid]) { if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE) && current[playerid] != -1)//change to key whatever u want { switch(current[playerid]) { case 0://player is on menu item 1 do something case 1://player is on menu item 2 } } } return 1; } /*this all when u hide menu or player disconnects current[playerid] = -1; IsViewingMenu[playerid] = false;/*
TD_test.pwn(13) : error 010: invalid function or declaration TD_test.pwn(24) : error 010: invalid function or declaration TD_test.pwn(35) : error 010: invalid function or declaration TD_test.pwn(85) : warning 217: loose indentation TD_test.pwn(85) : error 029: invalid expression, assumed zero TD_test.pwn(85) : warning 215: expression has no effect TD_test.pwn(85) : error 001: expected token: ";", but found "if" TD_test.pwn(103) : error 017: undefined symbol "Textdraw3" TD_test.pwn(103) : warning 215: expression has no effect TD_test.pwn(103) : error 001: expected token: ";", but found "]" TD_test.pwn(103) : error 029: invalid expression, assumed zero TD_test.pwn(103) : fatal error 107: too many error messages on one line Compilation aborted.[Finished in 0.2s with exit code 1]